From da92c67de66d84ab9291899c4fcbb51ef5fc9683 Mon Sep 17 00:00:00 2001 From: Grzegorz Gajoch Date: Thu, 4 Jan 2024 04:01:35 +0100 Subject: [PATCH] change 'extra_attributes' type to tuple --- custom_components/luxtronik/model.py | 4 +--- .../luxtronik/number_entities_predefined.py | 4 ++-- .../luxtronik/sensor_entities_predefined.py | 20 +++++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/custom_components/luxtronik/model.py b/custom_components/luxtronik/model.py index d3e0a80..b60ffb4 100644 --- a/custom_components/luxtronik/model.py +++ b/custom_components/luxtronik/model.py @@ -80,9 +80,7 @@ class LuxtronikEntityDescription(EntityDescription): invisible_if_value: Any | None = None min_firmware_version_minor: FirmwareVersionMinor | None = None - extra_attributes: list[LuxtronikEntityAttributeDescription] = field( - default_factory=list - ) + extra_attributes: tuple(LuxtronikEntityAttributeDescription) = () state_class: str | None = None diff --git a/custom_components/luxtronik/number_entities_predefined.py b/custom_components/luxtronik/number_entities_predefined.py index a5e1a2f..46a5491 100644 --- a/custom_components/luxtronik/number_entities_predefined.py +++ b/custom_components/luxtronik/number_entities_predefined.py @@ -408,14 +408,14 @@ entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, factor=0.1, - extra_attributes=[ + extra_attributes=( attr( SA.LAST_THERMAL_DESINFECTION, LC.C0017_DHW_TEMPERATURE, SensorAttrFormat.TIMESTAMP_LAST_OVER, True, ), - ], + ), ), # region Solar LuxtronikNumberDescription( diff --git a/custom_components/luxtronik/sensor_entities_predefined.py b/custom_components/luxtronik/sensor_entities_predefined.py index 2a1b2e0..f06e669 100644 --- a/custom_components/luxtronik/sensor_entities_predefined.py +++ b/custom_components/luxtronik/sensor_entities_predefined.py @@ -46,12 +46,12 @@ luxtronik_key=LC.C0080_STATUS, icon_by_state=LUX_STATE_ICON_MAP, device_class=SensorDeviceClass.ENUM, - extra_attributes=[ + extra_attributes=( attr(SA.EVU_FIRST_START_TIME, LC.UNSET, None, True), attr(SA.EVU_FIRST_END_TIME, LC.UNSET, None, True), attr(SA.EVU_SECOND_START_TIME, LC.UNSET, None, True), attr(SA.EVU_SECOND_END_TIME, LC.UNSET, None, True), - ], + ), options=[e.value for e in LuxOperationMode], update_interval=UPDATE_INTERVAL_NORMAL, ), @@ -79,7 +79,7 @@ native_unit_of_measurement=UnitOfTime.SECONDS, entity_registry_visible_default=False, native_precision=0, - extra_attributes=[ + extra_attributes=( attr(SA.STATUS_TEXT, LC.C0120_STATUS_TIME, SensorAttrFormat.HOUR_MINUTE), attr(SA.TIMER_HEATPUMP_ON, LC.C0067_TIMER_HEATPUMP_ON), attr(SA.TIMER_ADD_HEAT_GENERATOR_ON, LC.C0068_TIMER_ADD_HEAT_GENERATOR_ON), @@ -94,7 +94,7 @@ attr(SA.TIMER_BLOCK_DHW, LC.C0077_TIMER_BLOCK_DHW), attr(SA.TIMER_DEFROST, LC.C0141_TIMER_DEFROST), attr(SA.TIMER_HOT_GAS, LC.C0158_TIMER_HOT_GAS), - ], + ), ), descr( key=SensorKey.STATUS_LINE_1, @@ -436,12 +436,12 @@ key=SensorKey.ERROR_REASON, luxtronik_key=LC.C0100_ERROR_REASON, icon="mdi:alert", - extra_attributes=[ + extra_attributes=( attr(SA.TIMESTAMP, LC.C0095_ERROR_TIME), attr(SA.CODE, LC.C0100_ERROR_REASON), attr(SA.CAUSE, LC.C0100_ERROR_REASON), attr(SA.REMEDY, LC.C0100_ERROR_REASON), - ], + ), ), # endregion Main heatpump # region Heating @@ -454,13 +454,13 @@ state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, - extra_attributes=[ + extra_attributes=( attr( SA.MAX_ALLOWED, LP.P0149_FLOW_IN_TEMPERATURE_MAX_ALLOWED, SensorAttrFormat.CELSIUS_TENTH, ), - ], + ), ), descr( key=SensorKey.FLOW_OUT_TEMPERATURE, @@ -481,13 +481,13 @@ state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, - extra_attributes=[ + extra_attributes=( attr( SA.SWITCH_GAP, LC.C0011_FLOW_OUT_TEMPERATURE, SensorAttrFormat.SWITCH_GAP, ), - ], + ), ), descr( key=SensorKey.OPERATION_HOURS_HEATING,