mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Avoid mutating entity descriptions in solaredge (#105974)
This commit is contained in:
parent
393da7b2e0
commit
77c72f2402
@ -2,8 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from copy import copy
|
import dataclasses
|
||||||
from dataclasses import dataclass
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
import statistics
|
import statistics
|
||||||
@ -51,7 +50,7 @@ INVERTER_MODES = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclasses.dataclass
|
||||||
class SolarEdgeLocalSensorEntityDescription(SensorEntityDescription):
|
class SolarEdgeLocalSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Describes SolarEdge-local sensor entity."""
|
"""Describes SolarEdge-local sensor entity."""
|
||||||
|
|
||||||
@ -231,10 +230,11 @@ def setup_platform(
|
|||||||
data = SolarEdgeData(hass, api)
|
data = SolarEdgeData(hass, api)
|
||||||
|
|
||||||
# Changing inverter temperature unit.
|
# Changing inverter temperature unit.
|
||||||
inverter_temp_description = copy(SENSOR_TYPE_INVERTER_TEMPERATURE)
|
inverter_temp_description = SENSOR_TYPE_INVERTER_TEMPERATURE
|
||||||
if status.inverters.primary.temperature.units.farenheit:
|
if status.inverters.primary.temperature.units.farenheit:
|
||||||
inverter_temp_description.native_unit_of_measurement = (
|
inverter_temp_description = dataclasses.replace(
|
||||||
UnitOfTemperature.FAHRENHEIT
|
inverter_temp_description,
|
||||||
|
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create entities
|
# Create entities
|
||||||
|
Loading…
x
Reference in New Issue
Block a user