From bb1b247e98aa84979a0f75cb5ac000dbce21a1b5 Mon Sep 17 00:00:00 2001 From: Benjamin <78026082+benjamin-dcs@users.noreply.github.com> Date: Tue, 24 Dec 2024 09:57:00 +0100 Subject: [PATCH] refactor key --- .../ithodaalderop/binary_sensor.py | 15 +- .../ithodaalderop/definitions/autotemp.py | 66 ++-- .../ithodaalderop/definitions/base.py | 6 +- .../ithodaalderop/definitions/co2_remote.py | 4 +- .../ithodaalderop/definitions/cve.py | 88 ++--- .../ithodaalderop/definitions/hru200.py | 58 +-- .../ithodaalderop/definitions/hru250_300.py | 66 ++-- .../ithodaalderop/definitions/hru350.py | 62 +-- .../ithodaalderop/definitions/hrueco.py | 50 +-- .../ithodaalderop/definitions/last_command.py | 6 +- .../ithodaalderop/definitions/wpu.py | 358 +++++++++--------- custom_components/ithodaalderop/sensor.py | 43 ++- ..._sensor_autotemp.py => sensor_autotemp.py} | 6 +- .../{_sensor_base.py => sensor_base.py} | 3 +- ...sor_co2_remote.py => sensor_co2_remote.py} | 4 +- .../{_sensor_fan.py => sensor_fan.py} | 4 +- ...last_command.py => sensor_last_command.py} | 4 +- .../{_sensor_wpu.py => sensor_wpu.py} | 4 +- 18 files changed, 428 insertions(+), 419 deletions(-) rename custom_components/ithodaalderop/{_sensor_autotemp.py => sensor_autotemp.py} (94%) rename custom_components/ithodaalderop/{_sensor_base.py => sensor_base.py} (94%) rename custom_components/ithodaalderop/{_sensor_co2_remote.py => sensor_co2_remote.py} (91%) rename custom_components/ithodaalderop/{_sensor_fan.py => sensor_fan.py} (97%) rename custom_components/ithodaalderop/{_sensor_last_command.py => sensor_last_command.py} (90%) rename custom_components/ithodaalderop/{_sensor_wpu.py => sensor_wpu.py} (94%) diff --git a/custom_components/ithodaalderop/binary_sensor.py b/custom_components/ithodaalderop/binary_sensor.py index c31cdd6..e42027e 100644 --- a/custom_components/ithodaalderop/binary_sensor.py +++ b/custom_components/ithodaalderop/binary_sensor.py @@ -45,7 +45,7 @@ async def async_setup_entry( sensors = [] if config_entry.data[CONF_ADDON_TYPE] == "cve": for description in CVE_BINARY_SENSORS: - description.key = f"{MQTT_BASETOPIC["cve"]}/{MQTT_STATETOPIC["cve"]}" + description.topic = f"{MQTT_BASETOPIC["cve"]}/{MQTT_STATETOPIC["cve"]}" sensors.append(IthoBinarySensor(description, config_entry)) if config_entry.data[CONF_ADDON_TYPE] == "noncve" and config_entry.data[ @@ -57,12 +57,14 @@ async def async_setup_entry( hru_sensors = HRU_ECO_350_BINARY_SENSORS for description in hru_sensors: - description.key = f"{MQTT_BASETOPIC["noncve"]}/{MQTT_STATETOPIC["noncve"]}" + description.topic = ( + f"{MQTT_BASETOPIC["noncve"]}/{MQTT_STATETOPIC["noncve"]}" + ) sensors.append(IthoBinarySensor(description, config_entry)) if config_entry.data[CONF_ADDON_TYPE] == "wpu": for description in WPU_BINARY_SENSORS: - description.key = f"{MQTT_BASETOPIC["wpu"]}/{MQTT_STATETOPIC["wpu"]}" + description.topic = f"{MQTT_BASETOPIC["wpu"]}/{MQTT_STATETOPIC["wpu"]}" sensors.append(IthoBinarySensor(description, config_entry)) async_add_entities(sensors) @@ -81,6 +83,7 @@ def __init__( ) -> None: """Initialize the binary sensor.""" self.entity_description = description + self.entity_description.translation_key = self.entity_description.key model = ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]] if config_entry.data[CONF_ADDON_TYPE] == "noncve": @@ -93,7 +96,9 @@ def __init__( name="Itho Daalderop " + ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]], ) - self._attr_unique_id = f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.translation_key}" + self._attr_unique_id = ( + f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.key}" + ) self.entity_id = f"binary_sensor.{self._attr_unique_id}" @property @@ -127,5 +132,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) diff --git a/custom_components/ithodaalderop/definitions/autotemp.py b/custom_components/ithodaalderop/definitions/autotemp.py index b5efcbd..ce552fc 100644 --- a/custom_components/ithodaalderop/definitions/autotemp.py +++ b/custom_components/ithodaalderop/definitions/autotemp.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho Autotemp sensors added to MQTT.""" from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.const import ( @@ -13,7 +13,7 @@ AUTOTEMP_COMM_SPACE_SENSOR_TEMPLATE = IthoSensorEntityDescription( json_field="Comm space X (sec)", - translation_key="comm_space", + key="comm_space", unique_id_template="comm_space_x", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, @@ -23,7 +23,7 @@ AUTOTEMP_DISTRIBUTOR_VALVE_SENSOR_TEMPLATE = IthoSensorEntityDescription( json_field="Distributor X valve Y", - translation_key="distributor_valve", + key="distributor_valve", unique_id_template="distributor_x_valve_y", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -32,7 +32,7 @@ AUTOTEMP_MALFUNCTION_VALVE_DECTECTION_DIST_SENSOR_TEMPLATE = ( IthoSensorEntityDescription( json_field="Malfunction valve detection dist X", - translation_key="malfunction_valve_detection_dist", + key="malfunction_valve_detection_dist", unique_id_template="malfunction_valve_detection_dist_x", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -42,28 +42,28 @@ AUTOTEMP_ROOM_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Room X power % (%)", - translation_key="power_perc", + key="power_perc", device_class=SensorDeviceClass.POWER_FACTOR, native_unit_of_measurement="%", state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Room X power kW (kW)", - translation_key="power_kw", + key="power_kw", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.KILO_WATT, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Room X setp", - translation_key="setpoint_temp", + key="setpoint_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Room X temp", - translation_key="actual_temp", + key="actual_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -73,25 +73,25 @@ AUTOTEMP_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Condition", - translation_key="condition", + key="condition", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Condition cool", - translation_key="condition_cool", + key="condition_cool", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Condition off", - translation_key="condition_off", + key="condition_off", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Cycle counter (sec)", - translation_key="cycle_counter", + key="cycle_counter", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -99,7 +99,7 @@ ), IthoSensorEntityDescription( json_field="Desired power (%)", - translation_key="desired_power", + key="desired_power", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -107,53 +107,53 @@ ), IthoSensorEntityDescription( json_field="Error", - translation_key="error", + key="error", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Heat source", - translation_key="heat_source", + key="heat_source", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="LED_Fast", - translation_key="led_fast", + key="led_fast", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="LED_On", - translation_key="led_on", + key="led_on", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="LED_Slow", - translation_key="led_slow", + key="led_slow", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Mode", - translation_key="mode", + key="mode", ), IthoSensorEntityDescription( json_field="Outdoor temp (°C)", - translation_key="outdoor_temp", + key="outdoor_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Particulars", - translation_key="particulars", + key="particulars", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Rest cycle time (sec)", - translation_key="rest_cycle_time", + key="rest_cycle_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -161,7 +161,7 @@ ), IthoSensorEntityDescription( json_field="Rest vent time (sec)", - translation_key="rest_vent_time", + key="rest_vent_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -169,7 +169,7 @@ ), IthoSensorEntityDescription( json_field="Rest vent time (sec)", - translation_key="rest_vent_time", + key="rest_vent_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -177,37 +177,37 @@ ), IthoSensorEntityDescription( json_field="State cool", - translation_key="state_cool", + key="state_cool", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="State hand", - translation_key="state_hand", + key="state_hand", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="state hand", - translation_key="state_hand2", + key="state_hand2", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="State heating", - translation_key="state_heating", + key="state_heating", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="State off", - translation_key="state", + key="state", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Time active zone too cold (sec)", - translation_key="time_active_zone_too_cold", + key="time_active_zone_too_cold", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -215,7 +215,7 @@ ), IthoSensorEntityDescription( json_field="Valve failure detection distributor 1", - translation_key="valve_failure_detection_distributor_1", + key="valve_failure_detection_distributor_1", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), @@ -224,14 +224,14 @@ AUTOTEMP_VALVE_SENSOR_TEMPLATE: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="VX_valve", - translation_key="v_valve", + key="v_valve", unique_id_template="vx_valve", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Valve failure distributor X", - translation_key="valve_failure_distributor", + key="valve_failure_distributor", unique_id_template="valve_failure_distributor_x", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, diff --git a/custom_components/ithodaalderop/definitions/base.py b/custom_components/ithodaalderop/definitions/base.py index 460342d..fa5e1b1 100644 --- a/custom_components/ithodaalderop/definitions/base.py +++ b/custom_components/ithodaalderop/definitions/base.py @@ -19,9 +19,10 @@ class IthoBinarySensorEntityDescription(BinarySensorEntityDescription): """Binary Sensor entity description for Itho.""" + key: str | None = None state: Callable | None = None json_field: str | None = None - key: str | None = None + topic: str | None = None icon: str | None = None icon_off: str | None = None icon_on: str | None = None @@ -34,9 +35,10 @@ class IthoBinarySensorEntityDescription(BinarySensorEntityDescription): class IthoSensorEntityDescription(SensorEntityDescription): """Sensor entity description for Itho.""" + key: str | None = None state: Callable | None = None json_field: str | None = None - key: str | None = None + topic: str | None = None icon: str | None = None unique_id_template: str | None = None unique_id: str | None = None diff --git a/custom_components/ithodaalderop/definitions/co2_remote.py b/custom_components/ithodaalderop/definitions/co2_remote.py index 7505ead..55f7b29 100644 --- a/custom_components/ithodaalderop/definitions/co2_remote.py +++ b/custom_components/ithodaalderop/definitions/co2_remote.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho CO2 Remote sensors added to MQTT.""" from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.const import CONCENTRATION_PARTS_PER_MILLION @@ -6,7 +6,7 @@ from .base import IthoSensorEntityDescription REMOTE_SENSOR_TEMPLATE = IthoSensorEntityDescription( - translation_key="remote", + key="remote", device_class=SensorDeviceClass.CO2, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, diff --git a/custom_components/ithodaalderop/definitions/cve.py b/custom_components/ithodaalderop/definitions/cve.py index 72db927..361978e 100644 --- a/custom_components/ithodaalderop/definitions/cve.py +++ b/custom_components/ithodaalderop/definitions/cve.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho CVE sensors added to MQTT.""" from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass @@ -16,7 +16,7 @@ CVE_BINARY_SENSORS: tuple[IthoBinarySensorEntityDescription, ...] = ( IthoBinarySensorEntityDescription( json_field="Filter dirty", - translation_key="filter_dirty", + key="filter_dirty", device_class=BinarySensorDeviceClass.PROBLEM, entity_category=EntityCategory.DIAGNOSTIC, icon_off="mdi:air-filter", @@ -27,7 +27,7 @@ CVE_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Absence (min)", - translation_key="absence", + key="absence", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -35,34 +35,34 @@ ), IthoSensorEntityDescription( json_field="CO2 value (ppm)", - translation_key="co2_value", + key="co2_value", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Co2 velocity", - translation_key="co2_velocity", + key="co2_velocity", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="CO2 ventilation (%)", - translation_key="co2_ventilation", + key="co2_ventilation", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Condition", - translation_key="condition", + key="condition", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Counter min-time (s)", - translation_key="counter_min_time", + key="counter_min_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -70,7 +70,7 @@ ), IthoSensorEntityDescription( json_field="Counter stop (s)", - translation_key="counter_stop", + key="counter_stop", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -78,20 +78,20 @@ ), IthoSensorEntityDescription( json_field="Current period", - translation_key="current_period", + key="current_period", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Cycle timer", - translation_key="cycle_timer", + key="cycle_timer", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Deferred absence (min)", - translation_key="deferred_absence", + key="deferred_absence", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -99,31 +99,31 @@ ), IthoSensorEntityDescription( json_field="Enhanced bathroom", - translation_key="enhanced_bathroom", + key="enhanced_bathroom", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Error", - translation_key="error", + key="error", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Fan setpoint (rpm)", - translation_key="fan_setpoint_rpm", + key="fan_setpoint_rpm", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Fan speed (rpm)", - translation_key="fan_speed", + key="fan_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Highest CO2 concentration (ppm)", - translation_key="highest_received_co2_value", + key="highest_received_co2_value", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -131,20 +131,20 @@ ), IthoSensorEntityDescription( json_field="Highest RH concentration (%)", - translation_key="highest_received_rh_value", + key="highest_received_rh_value", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="hum", - translation_key="humidity", + key="humidity", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Internal humidity (%)", - translation_key="internal_humidity", + key="internal_humidity", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -152,7 +152,7 @@ ), IthoSensorEntityDescription( json_field="Internal temp (°C)", - translation_key="internal_temp", + key="internal_temp", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -160,7 +160,7 @@ ), IthoSensorEntityDescription( json_field="Measurement actual (%)", - translation_key="measurement_actual", + key="measurement_actual", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -168,7 +168,7 @@ ), IthoSensorEntityDescription( json_field="Measurement previous first (%)", - translation_key="measurement_previous_first", + key="measurement_previous_first", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -176,7 +176,7 @@ ), IthoSensorEntityDescription( json_field="Measurement previous second (%)", - translation_key="measurement_previous_second", + key="measurement_previous_second", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -184,124 +184,124 @@ ), IthoSensorEntityDescription( json_field="New level time", - translation_key="new_level_time", + key="new_level_time", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Next Rfspeed absolute", - translation_key="next_rfspeed_absolute", + key="next_rfspeed_absolute", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Next Rfspeed level", - translation_key="next_rfspeed_level", + key="next_rfspeed_level", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Period timer", - translation_key="period_timer", + key="period_timer", state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Presence timer (sec)", - translation_key="presence_timer", + key="presence_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="RelativeHumidity", - translation_key="relative_humidity", + key="relative_humidity", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Rfspeed absolute", - translation_key="rfspeed_absolute", + key="rfspeed_absolute", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Sample timer", - translation_key="sample_timer", + key="sample_timer", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Selected mode", - translation_key="selected_mode", + key="selected_mode", entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Selection", - translation_key="selection", + key="selection", entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Sensor fault", - translation_key="sensor_fault", + key="sensor_fault", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Speed timer", - translation_key="speed_timer", + key="speed_timer", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Startup counter", - translation_key="start_up_counter", + key="start_up_counter", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="temp", - translation_key="temp", + key="temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Temperature", - translation_key="temperature", + key="temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Total operation (hours)", - translation_key="total_operation_time", + key="total_operation_time", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Valve", - translation_key="valve", + key="valve", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Ventilation level (%)", - translation_key="ventilation_level", + key="ventilation_level", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Ventilation request (%)", - translation_key="ventilation_request", + key="ventilation_request", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -309,7 +309,7 @@ ), IthoSensorEntityDescription( json_field="Ventilation setpoint (%)", - translation_key="ventilation_setpoint_percentage", + key="ventilation_setpoint_percentage", native_unit_of_measurement=PERCENTAGE, ), ) diff --git a/custom_components/ithodaalderop/definitions/hru200.py b/custom_components/ithodaalderop/definitions/hru200.py index e992304..f5fc211 100644 --- a/custom_components/ithodaalderop/definitions/hru200.py +++ b/custom_components/ithodaalderop/definitions/hru200.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho HRU 200 sensors added to MQTT.""" from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.const import ( @@ -15,7 +15,7 @@ HRU_ECO_200_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Absence (min)", - translation_key="absence", + key="absence", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -23,27 +23,27 @@ ), IthoSensorEntityDescription( json_field="Actual speed (rpm)", - translation_key="actual_speed", + key="actual_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Air discharge temperature (°C)", - translation_key="air_discharge_temp", + key="air_discharge_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Average air outlet temperature (°C)", - translation_key="average_air_outlet_temp", + key="average_air_outlet_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Block timer bypass (min)", - translation_key="block_timer_bypass", + key="block_timer_bypass", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -51,13 +51,13 @@ ), IthoSensorEntityDescription( json_field="Bypass mode", - translation_key="bypass_mode", + key="bypass_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Bypass setpoint (%)", - translation_key="bypass_setpoint", + key="bypass_setpoint", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -65,7 +65,7 @@ ), IthoSensorEntityDescription( json_field="Current bypass share (%)", - translation_key="current_bypass_share", + key="current_bypass_share", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -73,7 +73,7 @@ ), IthoSensorEntityDescription( json_field="Deferred absence (min)", - translation_key="deferred_absence", + key="deferred_absence", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -81,7 +81,7 @@ ), IthoSensorEntityDescription( json_field="Duration of current frost setpoint (sec)", - translation_key="duration_of_current_frost_setpoint", + key="duration_of_current_frost_setpoint", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -89,12 +89,12 @@ ), IthoSensorEntityDescription( json_field="Error", - translation_key="error", + key="error", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Fan off during frost (min)", - translation_key="fan_off_during_frost", + key="fan_off_during_frost", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -102,7 +102,7 @@ ), IthoSensorEntityDescription( json_field="Filter use counter (hour)", - translation_key="filter_use_counter", + key="filter_use_counter", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, @@ -110,7 +110,7 @@ ), IthoSensorEntityDescription( json_field="Frost adjustment speed (rpm)", - translation_key="frost_adjustment_speed", + key="frost_adjustment_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -118,13 +118,13 @@ ), IthoSensorEntityDescription( json_field="Frost status", - translation_key="frost_status", + key="frost_status", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Max. CO2 level (ppm)", - translation_key="max_co2_level", + key="max_co2_level", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -132,7 +132,7 @@ ), IthoSensorEntityDescription( json_field="Max frost vent. speed (rpm)", - translation_key="max_frost_vent_speed", + key="max_frost_vent_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -140,21 +140,21 @@ ), IthoSensorEntityDescription( json_field="Max. RH level (%)", - translation_key="max_rh_level", + key="max_rh_level", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Number of bypass settings", - translation_key="number_of_bypass_settings", + key="number_of_bypass_settings", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Periodic bypass valve travel (min)", - translation_key="periodic_bypass_valve_travel", + key="periodic_bypass_valve_travel", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -162,7 +162,7 @@ ), IthoSensorEntityDescription( json_field="Position of frost valve (%)", - translation_key="position_of_frost_valve", + key="position_of_frost_valve", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -170,27 +170,27 @@ ), IthoSensorEntityDescription( json_field="Room temp setpoint (°C)", - translation_key="room_temp_setpoint", + key="room_temp_setpoint", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Outside temperature (°C)", - translation_key="outside_temp", + key="outside_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Selection", - translation_key="selection", + key="selection", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Speed setpoint (rpm)", - translation_key="speed_setpoint", + key="speed_setpoint", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -198,21 +198,21 @@ ), IthoSensorEntityDescription( json_field="Start-up counter", - translation_key="start_up_counter", + key="start_up_counter", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Total operation (hrs)", - translation_key="total_operation_time", + key="total_operation_time", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Ventilation setpoint (%)", - translation_key="ventilation_setpoint_percentage", + key="ventilation_setpoint_percentage", native_unit_of_measurement=PERCENTAGE, ), ) diff --git a/custom_components/ithodaalderop/definitions/hru250_300.py b/custom_components/ithodaalderop/definitions/hru250_300.py index 21725c9..d0ac51f 100644 --- a/custom_components/ithodaalderop/definitions/hru250_300.py +++ b/custom_components/ithodaalderop/definitions/hru250_300.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho HRU 250 and HRU 300 sensors added to MQTT.""" from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.const import ( @@ -17,20 +17,20 @@ HRU_ECO_250_300_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Absolute speed of the fan (%)", - translation_key="absolute_fanspeed", + key="absolute_fanspeed", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Busy doing adjustments (-)", - translation_key="busy_doing_adjustments", + key="busy_doing_adjustments", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Current consumption of fan (mA)", - translation_key="current_consumption_fan", + key="current_consumption_fan", device_class=SensorDeviceClass.CURRENT, native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE, state_class=SensorStateClass.MEASUREMENT, @@ -38,14 +38,14 @@ ), IthoSensorEntityDescription( json_field="Desired capacity (m3/h)", - translation_key="desired_capacity", + key="desired_capacity", device_class=SensorDeviceClass.VOLUME_FLOW_RATE, native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Desired current consumption of fan (mA)", - translation_key="desired_consumption_fan", + key="desired_consumption_fan", device_class=SensorDeviceClass.CURRENT, native_unit_of_measurement=UnitOfElectricCurrent.MILLIAMPERE, state_class=SensorStateClass.MEASUREMENT, @@ -53,12 +53,12 @@ ), IthoSensorEntityDescription( json_field="Error number", - translation_key="error_number", + key="error_number", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Highest measured CO2 (ppm)", - translation_key="highest_measured_co2_value", + key="highest_measured_co2_value", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -66,14 +66,14 @@ ), IthoSensorEntityDescription( json_field="Highest measured RH (%)", - translation_key="highest_measured_rh_value", + key="highest_measured_rh_value", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Hysteresis of the frost (K)", - translation_key="hysteresis_of_the_frost", + key="hysteresis_of_the_frost", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -81,7 +81,7 @@ ), IthoSensorEntityDescription( json_field="Hysteresis use in control mode (K)", - translation_key="hysteresis_use_in_control_mode", + key="hysteresis_use_in_control_mode", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -89,14 +89,14 @@ ), IthoSensorEntityDescription( json_field="Inlet temperature (°C)", - translation_key="inlet_temp", + key="inlet_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Measured blend temperature heated NTC (°C)", - translation_key="measured_blend_temp_heated", + key="measured_blend_temp_heated", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, entity_category=EntityCategory.DIAGNOSTIC, @@ -104,28 +104,28 @@ ), IthoSensorEntityDescription( json_field="Measured outside temperature (°C)", - translation_key="outside_temp", + key="outside_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Measured temperature of mixed outside air (°C)", - translation_key="mixed_outside_air_temp", + key="mixed_outside_air_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Measured waste temperature heated NTC (°C)", - translation_key="measured_waste_temp_heated", + key="measured_waste_temp_heated", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Number of hours of too cold air (hour)", - translation_key="number_of_hours_of_too_cold_air", + key="number_of_hours_of_too_cold_air", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -133,33 +133,33 @@ ), IthoSensorEntityDescription( json_field="Number of steps the frost valve is open (steps)", - translation_key="number_of_steps_the_frost_valve_is_open", + key="number_of_steps_the_frost_valve_is_open", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Percentage that the bypass valve is open (%)", - translation_key="bypass_valve_open", + key="bypass_valve_open", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Relative fanspeed (%)", - translation_key="relative_fanspeed", + key="relative_fanspeed", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="RPM of the motor (rpm)", - translation_key="motor_speed", + key="motor_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Sample timer in frost mode (min)", - translation_key="sample_timer_in_frost_mode", + key="sample_timer_in_frost_mode", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -167,25 +167,25 @@ ), IthoSensorEntityDescription( json_field="Status", - translation_key="status", + key="status", ), IthoSensorEntityDescription( json_field="Temperature of the blown out air of the house (°C)", - translation_key="blown_out_air_temp", + key="blown_out_air_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Temperature of the extracted air (°C)", - translation_key="extracted_air_temp", + key="extracted_air_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Temporary speed reduction (rpm)", - translation_key="temporary_speed_reduction", + key="temporary_speed_reduction", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -193,40 +193,40 @@ ), IthoSensorEntityDescription( json_field="The desired inlet temperature (°C)", - translation_key="desired_inlet_temp", + key="desired_inlet_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="The flow of the blown air (m3/h)", - translation_key="flow_blown_air", + key="flow_blown_air", device_class=SensorDeviceClass.VOLUME_FLOW_RATE, native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="The flow of the inflated air (M3/h)", - translation_key="flow_inflated_air", + key="flow_inflated_air", device_class=SensorDeviceClass.VOLUME_FLOW_RATE, native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="The mass flow of the air entering the house (kg/h)", - translation_key="mass_flow_air_enter_house_kgh", + key="mass_flow_air_enter_house_kgh", native_unit_of_measurement="kg/h", state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="The mass flow of the air leaving the house (kg/h)", - translation_key="mass_flow_air_leaving_house_kgh", + key="mass_flow_air_leaving_house_kgh", native_unit_of_measurement="kg/h", state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Timer for how long the house is cooled (hour)", - translation_key="timer_for_how_long_the_house_is_cooled", + key="timer_for_how_long_the_house_is_cooled", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -234,7 +234,7 @@ ), IthoSensorEntityDescription( json_field="Timer for how long the house is heated (hour)", - translation_key="timer_for_how_long_the_house_is_heated", + key="timer_for_how_long_the_house_is_heated", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, diff --git a/custom_components/ithodaalderop/definitions/hru350.py b/custom_components/ithodaalderop/definitions/hru350.py index f1c8204..b142e93 100644 --- a/custom_components/ithodaalderop/definitions/hru350.py +++ b/custom_components/ithodaalderop/definitions/hru350.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho HRU 350 sensors added to MQTT.""" from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass @@ -16,7 +16,7 @@ HRU_ECO_350_BINARY_SENSORS: tuple[IthoBinarySensorEntityDescription, ...] = ( IthoBinarySensorEntityDescription( json_field="Bypass position", - translation_key="bypass_position", + key="bypass_position", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, icon_off="mdi:valve-closed", @@ -24,7 +24,7 @@ ), IthoBinarySensorEntityDescription( json_field="Valve position", - translation_key="valve_position", + key="valve_position", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, icon_off="mdi:valve-closed", @@ -36,12 +36,12 @@ HRU_ECO_350_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Actual Mode", - translation_key="actual_mode", + key="actual_mode", icon="mdi:knob", ), IthoSensorEntityDescription( json_field="Airfilter counter", - translation_key="airfilter_counter", + key="airfilter_counter", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, @@ -49,52 +49,52 @@ ), IthoSensorEntityDescription( json_field="Air Quality (%)", - translation_key="airquality", + key="airquality", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Balance (%)", - translation_key="balance", + key="balance", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Boiler timer", - translation_key="boiler_timer", + key="boiler_timer", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Current position", - translation_key="current_position", + key="current_position", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Exhaust fan (RPM)", - translation_key="actual_exhaust_fan", + key="actual_exhaust_fan", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Exhaust fan actual (RPM)", - translation_key="exhaust_fan_actual", + key="exhaust_fan_actual", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Exhaust temp (°C)", - translation_key="actual_exhaust_temp", + key="actual_exhaust_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Fallback speed timer (Sec)", - translation_key="fallback_speed_timer", + key="fallback_speed_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -102,32 +102,32 @@ ), IthoSensorEntityDescription( json_field="Frost block", - translation_key="frost_block", + key="frost_block", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Frost timer", - translation_key="frost_timer", + key="frost_timer", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="GHEswitch", - translation_key="ghe_switch", + key="ghe_switch", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Global fault code", - translation_key="global_fault_code", + key="global_fault_code", icon="mdi:alert-circle-outline", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Highest received CO2 value (Ppm)", - translation_key="highest_received_co2_value", + key="highest_received_co2_value", native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -135,21 +135,21 @@ ), IthoSensorEntityDescription( json_field="Highest received RH value (%RH)", - translation_key="highest_received_rh_value", + key="highest_received_rh_value", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Outdoor temp (°C)", - translation_key="outdoor_temp", + key="outdoor_temp", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Remaining override timer (Sec)", - translation_key="remaining_override_timer", + key="remaining_override_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -157,7 +157,7 @@ ), IthoSensorEntityDescription( json_field="Requested fanspeed (%)", - translation_key="requested_fanspeed", + key="requested_fanspeed", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -165,7 +165,7 @@ ), IthoSensorEntityDescription( json_field="Pir fan speed level", - translation_key="pir_fan_speed_level", + key="pir_fan_speed_level", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -173,53 +173,53 @@ ), IthoSensorEntityDescription( json_field="Room temp (°C)", - translation_key="room_temp", + key="room_temp", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Status", - translation_key="status", + key="status", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Summercounter", - translation_key="summer_counter", + key="summer_counter", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Summerday (K_min)", - translation_key="summerday_k_min", + key="summerday_k_min", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Supply fan (RPM)", - translation_key="actual_supply_fan", + key="actual_supply_fan", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Supply fan actual (RPM)", - translation_key="supply_fan_actual", + key="supply_fan_actual", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Supply temp (°C)", - translation_key="actual_supply_temp", + key="actual_supply_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="VKKswitch", - translation_key="vkk_switch", + key="vkk_switch", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), diff --git a/custom_components/ithodaalderop/definitions/hrueco.py b/custom_components/ithodaalderop/definitions/hrueco.py index 15e5b4f..95c5e2b 100644 --- a/custom_components/ithodaalderop/definitions/hrueco.py +++ b/custom_components/ithodaalderop/definitions/hrueco.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho HRU Eco sensors added to MQTT.""" from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass @@ -15,7 +15,7 @@ HRU_ECO_BINARY_SENSORS: tuple[IthoBinarySensorEntityDescription, ...] = ( IthoBinarySensorEntityDescription( json_field="Bypass position (pulse)", - translation_key="bypass_position", + key="bypass_position", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, icon_off="mdi:valve-closed", @@ -23,7 +23,7 @@ ), IthoBinarySensorEntityDescription( json_field="Valve position (pulse)", - translation_key="valve_position", + key="valve_position", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, icon_off="mdi:valve-closed", @@ -35,7 +35,7 @@ HRU_ECO_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="Air filter counter", - translation_key="airfilter_counter", + key="airfilter_counter", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, @@ -43,14 +43,14 @@ ), IthoSensorEntityDescription( json_field="Balance (%)", - translation_key="balance", + key="balance", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="boiler timer (min)", - translation_key="boiler_timer", + key="boiler_timer", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -58,27 +58,27 @@ ), IthoSensorEntityDescription( json_field="Current pos", - translation_key="current_pos", + key="current_pos", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Drain actual (rpm)", - translation_key="drain_actual", + key="drain_actual", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Drain fan speed (rpm)", - translation_key="drain_fan_speed", + key="drain_fan_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Drain requested (rpm)", - translation_key="drain_requested", + key="drain_requested", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -86,13 +86,13 @@ ), IthoSensorEntityDescription( json_field="Frost lock", - translation_key="frost_lock", + key="frost_lock", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Frost timer (sec)", - translation_key="frost_timer", + key="frost_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -100,27 +100,27 @@ ), IthoSensorEntityDescription( json_field="GHE switch", - translation_key="ghe_switch", + key="ghe_switch", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Outdoor temp (°C)", - translation_key="outdoor_temp", + key="outdoor_temp", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Temp of exhaust air (°C)", - translation_key="actual_exhaust_temp", + key="actual_exhaust_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Requested speed (%)", - translation_key="requested_speed", + key="requested_speed", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -128,44 +128,44 @@ ), IthoSensorEntityDescription( json_field="room temp (°C)", - translation_key="room_temp", + key="room_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Status", - translation_key="status", + key="status", ), IthoSensorEntityDescription( json_field="summer counter", - translation_key="summer_counter", + key="summer_counter", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Summer day", - translation_key="summer_day", + key="summer_day", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Supply actual (rpm)", - translation_key="supply_actual", + key="supply_actual", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Supply fan speed (rpm)", - translation_key="supply_fan_speed", + key="supply_fan_speed", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Supply requested (rpm)", - translation_key="supply_requested", + key="supply_requested", native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -173,14 +173,14 @@ ), IthoSensorEntityDescription( json_field="Temp of supply air (°C)", - translation_key="actual_supply_temp", + key="actual_supply_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="VKK switch", - translation_key="vkk_switch", + key="vkk_switch", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), diff --git a/custom_components/ithodaalderop/definitions/last_command.py b/custom_components/ithodaalderop/definitions/last_command.py index 4724a5d..9c83b81 100644 --- a/custom_components/ithodaalderop/definitions/last_command.py +++ b/custom_components/ithodaalderop/definitions/last_command.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho Last Command sensors added to MQTT.""" from homeassistant.const import EntityCategory @@ -7,14 +7,14 @@ LAST_CMD_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="command", - translation_key="last_cmd_command", + key="last_cmd_command", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:cog", entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="source", - translation_key="last_cmd_source", + key="last_cmd_source", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:target", entity_registry_enabled_default=False, diff --git a/custom_components/ithodaalderop/definitions/wpu.py b/custom_components/ithodaalderop/definitions/wpu.py index b93d98f..1fce26b 100644 --- a/custom_components/ithodaalderop/definitions/wpu.py +++ b/custom_components/ithodaalderop/definitions/wpu.py @@ -1,4 +1,4 @@ -"""Definitions for Itho sensors added to MQTT.""" +"""Definitions for Itho WPU sensors added to MQTT.""" from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass @@ -18,196 +18,196 @@ WPU_BINARY_SENSORS: tuple[IthoBinarySensorEntityDescription, ...] = ( IthoBinarySensorEntityDescription( json_field="Bleeding mode blocked", - translation_key="bleeding_mode_blocked", + key="bleeding_mode_blocked", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Blockage", - translation_key="blockage", + key="blockage", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Boiler mode active", - translation_key="boiler_mode_active", + key="boiler_mode_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Boiler blocked from thermostat", - translation_key="boiler_blocked_from_thermostat", + key="boiler_blocked_from_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Boiler boost from thermostat", - translation_key="boiler_boost_from_thermostat", + key="boiler_boost_from_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Boiler mode blocked", - translation_key="boiler_mode_blocked", + key="boiler_mode_blocked", device_class=BinarySensorDeviceClass.OPENING, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Comfort selected on thermostat", - translation_key="comfort_selected_on_thermostat", + key="comfort_selected_on_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Compressor blocked", - translation_key="compressor_blocked", + key="compressor_blocked", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Compressor in Cv mode", - translation_key="compressor_in_cv_mode", + key="compressor_in_cv_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Compressor in boiler mode", - translation_key="compressor_in_boiler_mode", + key="compressor_in_boiler_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Condensation protection", - translation_key="condensation_protection", + key="condensation_protection", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="CV enabled", - translation_key="cv_enabled", + key="cv_enabled", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="CV mode active", - translation_key="cv_mode_active", + key="cv_mode_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="CV mode blocked", - translation_key="cv_mode_blocked", + key="cv_mode_blocked", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="ECO selected on thermostat", - translation_key="eco_selected_on_thermostat", + key="eco_selected_on_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Electr element DHW blocked", - translation_key="electr_element_dhw_blocked", + key="electr_element_dhw_blocked", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Electr element blocked", - translation_key="electr_element_blocked", + key="electr_element_blocked", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Element blocked during retry", - translation_key="element_blocked_during_retry", + key="element_blocked_during_retry", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Element in CV mode", - translation_key="element_in_cv_mode", + key="element_in_cv_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Element in boiler mode", - translation_key="element_in_boiler_mode", + key="element_in_boiler_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Element released", - translation_key="element_released", + key="element_released", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Error_found", - translation_key="error_found", + key="error_found", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Free cooling enabled", - translation_key="free_cooling_enabled", + key="free_cooling_enabled", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Free cooling mode active", - translation_key="free_cooling_mode_active", + key="free_cooling_mode_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Free cooling mode blocked", - translation_key="free_cooling_mode_blocked", + key="free_cooling_mode_blocked", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Manual operation", - translation_key="manual_operation", + key="manual_operation", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="OT time valid", - translation_key="ot_time_valid", + key="ot_time_valid", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Off mode active", - translation_key="off_mode_active", + key="off_mode_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Regeneration active", - translation_key="regeneration_active", + key="regeneration_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Task active", - translation_key="task_active", + key="task_active", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="UTC time valid", - translation_key="utc_time_valid", + key="utc_time_valid", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoBinarySensorEntityDescription( json_field="Venting from thermostat", - translation_key="venting_from_thermostat", + key="venting_from_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), @@ -215,7 +215,7 @@ WPU_ERROR_CODE_BYTE_TEMPLATE = IthoSensorEntityDescription( json_field="Error code byte ", - translation_key="error_code_byte", + key="error_code_byte", unique_id_template="error_code_byte_x", state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, @@ -224,13 +224,13 @@ WPU_SENSORS: tuple[IthoSensorEntityDescription, ...] = ( IthoSensorEntityDescription( json_field="adaptive fifo index", - translation_key="adaptive_fifo_index", + key="adaptive_fifo_index", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Adaptive overheat (K)", - translation_key="adaptive_overheat", + key="adaptive_overheat", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -239,7 +239,7 @@ ), IthoSensorEntityDescription( json_field="Adaptive timer (sec)", - translation_key="adaptive_timer", + key="adaptive_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -247,13 +247,13 @@ ), IthoSensorEntityDescription( json_field="Additional cooling release", - translation_key="additional_cooling_release", + key="additional_cooling_release", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Block time pre-heating tap water (sec)", - translation_key="block_time_pre_heating_tap_water", + key="block_time_pre_heating_tap_water", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -261,7 +261,7 @@ ), IthoSensorEntityDescription( json_field="Block time-release external cooling (sec)", - translation_key="block_time_release_external_cooling", + key="block_time_release_external_cooling", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -269,7 +269,7 @@ ), IthoSensorEntityDescription( json_field="Blocking time trickle low after CV operation (sec)", - translation_key="blocking_time_trickle_low_after_cv_operation", + key="blocking_time_trickle_low_after_cv_operation", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -277,7 +277,7 @@ ), IthoSensorEntityDescription( json_field="Blocking time trickle low after power-up (sec.)", - translation_key="blocking_time_trickle_low_after_power_up", + key="blocking_time_trickle_low_after_power_up", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -285,7 +285,7 @@ ), IthoSensorEntityDescription( json_field="Boiler for _ nadraai (sec)", - translation_key="boiler_for_nadraai", + key="boiler_for_nadraai", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -293,13 +293,13 @@ ), IthoSensorEntityDescription( json_field="Boiler pump (%)", - translation_key="boiler_pump_percent", + key="boiler_pump_percent", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Boiler temp down (°C)", - translation_key="boiler_temp_down", + key="boiler_temp_down", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -308,7 +308,7 @@ ), IthoSensorEntityDescription( json_field="Boiler temp up (°C)", - translation_key="boiler_temp_up", + key="boiler_temp_up", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -317,7 +317,7 @@ ), IthoSensorEntityDescription( json_field="Calculated CV condensation temp (°C)", - translation_key="calculated_cv_condensation_temp", + key="calculated_cv_condensation_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -326,7 +326,7 @@ ), IthoSensorEntityDescription( json_field="Calculated condensation temp DHW (°C)", - translation_key="calculated_condensation_temp_dhw", + key="calculated_condensation_temp_dhw", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -335,7 +335,7 @@ ), IthoSensorEntityDescription( json_field="Calculated evaporation temp CV (°C)", - translation_key="calculated_evaporation_temp_cv", + key="calculated_evaporation_temp_cv", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -344,7 +344,7 @@ ), IthoSensorEntityDescription( json_field="Calculated evaporation temp DHW (°C)", - translation_key="calculated_evaporation_temp_dhw", + key="calculated_evaporation_temp_dhw", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -353,7 +353,7 @@ ), IthoSensorEntityDescription( json_field="CH mode (h)", - translation_key="ch_mode", + key="ch_mode", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -361,14 +361,14 @@ ), IthoSensorEntityDescription( json_field="CH mode starts", - translation_key="ch_mode_starts", + key="ch_mode_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="CH pump on (h)", - translation_key="ch_pump_on", + key="ch_pump_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -376,14 +376,14 @@ ), IthoSensorEntityDescription( json_field="CH pump starts", - translation_key="ch_pump_starts", + key="ch_pump_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="CO valve position (%)", - translation_key="co_valve_position", + key="co_valve_position", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -391,7 +391,7 @@ ), IthoSensorEntityDescription( json_field="Compr block (sec)", - translation_key="compr_block", + key="compr_block", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -399,7 +399,7 @@ ), IthoSensorEntityDescription( json_field="Compr power on delay (sec)", - translation_key="compr_power_on_delay", + key="compr_power_on_delay", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -407,7 +407,7 @@ ), IthoSensorEntityDescription( json_field="Compressed gas temp (°C)", - translation_key="compressed_gas_temp", + key="compressed_gas_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -415,13 +415,13 @@ ), IthoSensorEntityDescription( json_field="Compressor", - translation_key="compressor", + key="compressor", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Compressor current (A)", - translation_key="compressor_current", + key="compressor_current", device_class=SensorDeviceClass.CURRENT, native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, state_class=SensorStateClass.MEASUREMENT, @@ -430,7 +430,7 @@ ), IthoSensorEntityDescription( json_field="Compressor on (h)", - translation_key="compressor_on", + key="compressor_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -438,7 +438,7 @@ ), IthoSensorEntityDescription( json_field="Compressor start (sec)", - translation_key="compressor_start", + key="compressor_start", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -446,14 +446,14 @@ ), IthoSensorEntityDescription( json_field="Compressor starts", - translation_key="compressor_starts", + key="compressor_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Cooling temp control valve setpoint (%)", - translation_key="cooling_temp_control_valve_setpoint", + key="cooling_temp_control_valve_setpoint", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -461,7 +461,7 @@ ), IthoSensorEntityDescription( json_field="Correction measurement delta source temperature (K)", - translation_key="correction_measurement_delta_source_temperature", + key="correction_measurement_delta_source_temperature", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -470,7 +470,7 @@ ), IthoSensorEntityDescription( json_field="Current e-element (A)", - translation_key="current_e_element", + key="current_e_element", native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -478,7 +478,7 @@ ), IthoSensorEntityDescription( json_field="Current source valve position (%)", - translation_key="current_source_valve_position", + key="current_source_valve_position", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -486,7 +486,7 @@ ), IthoSensorEntityDescription( json_field="Cv for _ naddraai (sec)", - translation_key="cv_for_naddraai", + key="cv_for_naddraai", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -494,32 +494,32 @@ ), IthoSensorEntityDescription( json_field="CV pressure (Bar)", - translation_key="cv_pressure", + key="cv_pressure", device_class=SensorDeviceClass.PRESSURE, native_unit_of_measurement=UnitOfPressure.BAR, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Cv pump (%)", - translation_key="cv_pump_percent", + key="cv_pump_percent", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="CV pump prime", - translation_key="cv_pump_prime", + key="cv_pump_prime", entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="CV return temp (°C)", - translation_key="cv_return_temp", + key="cv_return_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Cv start delay (sec)", - translation_key="cv_start_delay", + key="cv_start_delay", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -527,7 +527,7 @@ ), IthoSensorEntityDescription( json_field="Cv stop delay (sec)", - translation_key="cv_stop_delay", + key="cv_stop_delay", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -535,7 +535,7 @@ ), IthoSensorEntityDescription( json_field="CV supply temp (°C)", - translation_key="cv_supply_temp", + key="cv_supply_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -544,7 +544,7 @@ ), IthoSensorEntityDescription( json_field="CV_DHW or cooling temp valve (%)", - translation_key="cv_dhw_or_cooling_temp_valve", + key="cv_dhw_or_cooling_temp_valve", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -552,7 +552,7 @@ ), IthoSensorEntityDescription( json_field="DHW element on (h)", - translation_key="dhw_element_on", + key="dhw_element_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -560,14 +560,14 @@ ), IthoSensorEntityDescription( json_field="DHW element starts", - translation_key="dhw_element_starts", + key="dhw_element_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="DHW mode (h)", - translation_key="dhw_mode", + key="dhw_mode", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -575,14 +575,14 @@ ), IthoSensorEntityDescription( json_field="DHW mode starts", - translation_key="dhw_mode_starts", + key="dhw_mode_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="DHW pump on (h)", - translation_key="dhw_pump_on", + key="dhw_pump_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -590,14 +590,14 @@ ), IthoSensorEntityDescription( json_field="DHW pump starts", - translation_key="dhw_pump_starts", + key="dhw_pump_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Delay cv start (sec)", - translation_key="delay_cv_start", + key="delay_cv_start", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -605,7 +605,7 @@ ), IthoSensorEntityDescription( json_field="Delay cv stop (sec)", - translation_key="delay_cv_stop", + key="delay_cv_stop", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -613,7 +613,7 @@ ), IthoSensorEntityDescription( json_field="Delay electr (sec)", - translation_key="delay_electr", + key="delay_electr", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -621,7 +621,7 @@ ), IthoSensorEntityDescription( json_field="Drain time (sec)", - translation_key="drain_time", + key="drain_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -629,7 +629,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption DHW (kWh)", - translation_key="e_consumption_dhw", + key="e_consumption_dhw", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -637,7 +637,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption cooling (kWh)", - translation_key="e_consumption_cooling", + key="e_consumption_cooling", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -645,7 +645,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption during DHW (kWh)", - translation_key="e_consumption_during_dhw", + key="e_consumption_during_dhw", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -653,7 +653,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption during cooling (kWh)", - translation_key="e_consumption_during_cooling", + key="e_consumption_during_cooling", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -661,7 +661,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption during heating (kWh)", - translation_key="e_consumption_during_heating", + key="e_consumption_during_heating", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -669,7 +669,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption during stand-by (kWh)", - translation_key="e_consumption_during_stand_by", + key="e_consumption_during_stand_by", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -677,7 +677,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption heating (kWh)", - translation_key="e_consumption_heating", + key="e_consumption_heating", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -685,7 +685,7 @@ ), IthoSensorEntityDescription( json_field="E-consumption stand-by (kWh)", - translation_key="e_consumption_stand_by", + key="e_consumption_stand_by", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -693,7 +693,7 @@ ), IthoSensorEntityDescription( json_field="Electrical element on (h)", - translation_key="electrical_element_on", + key="electrical_element_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -701,7 +701,7 @@ ), IthoSensorEntityDescription( json_field="Electrical element release (min)", - translation_key="electrical_element_release", + key="electrical_element_release", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -709,14 +709,14 @@ ), IthoSensorEntityDescription( json_field="Electrical element starts", - translation_key="electrical_element_starts", + key="electrical_element_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Elek block (sec)", - translation_key="elek_block", + key="elek_block", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -724,38 +724,38 @@ ), IthoSensorEntityDescription( json_field="Element", - translation_key="element", + key="element", entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Energy out of source (MWh)", - translation_key="energy_out_of_source", + key="energy_out_of_source", native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Energy returned to source (MWh)", - translation_key="energy_returned_to_source", + key="energy_returned_to_source", native_unit_of_measurement=UnitOfEnergy.MEGA_WATT_HOUR, state_class=SensorStateClass.TOTAL_INCREASING, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Error", - translation_key="error", + key="error", entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="Error_retry", - translation_key="error_retry", + key="error_retry", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="EV adjust (sec)", - translation_key="ev_adjust", + key="ev_adjust", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -763,7 +763,7 @@ ), IthoSensorEntityDescription( json_field="EV pressure offset (sec)", - translation_key="ev_pressure_offset", + key="ev_pressure_offset", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -771,7 +771,7 @@ ), IthoSensorEntityDescription( json_field="Evaporator temp (°C)", - translation_key="evaporator_temp", + key="evaporator_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -780,14 +780,14 @@ ), IthoSensorEntityDescription( json_field="Expansion valve (pls)", - translation_key="expansion_valve", + key="expansion_valve", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="External heating release time (sec)", - translation_key="external_heating_release_time", + key="external_heating_release_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -795,33 +795,33 @@ ), IthoSensorEntityDescription( json_field="Fault highest priority", - translation_key="fault_highest_priority", + key="fault_highest_priority", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Flow sensor (lt_hr)", - translation_key="flow_sensor", + key="flow_sensor", native_unit_of_measurement="L/h", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, ), IthoSensorEntityDescription( json_field="FlowHardware", - translation_key="flow_hardware", + key="flow_hardware", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Free cooling", - translation_key="free_cooling", + key="free_cooling", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Free cooling block time (min)", - translation_key="free_cooling_block_time", + key="free_cooling_block_time", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -829,7 +829,7 @@ ), IthoSensorEntityDescription( json_field="Free cooling interval (sec)", - translation_key="free_cooling_interval", + key="free_cooling_interval", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -837,13 +837,13 @@ ), IthoSensorEntityDescription( json_field="Free cooling mode", - translation_key="free_cooling_mode", + key="free_cooling_mode", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Free cooling mode (h)", - translation_key="free_cooling_mode", + key="free_cooling_mode", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -851,7 +851,7 @@ ), IthoSensorEntityDescription( json_field="Free cooling on time (sec)", - translation_key="free_cooling_on_time", + key="free_cooling_on_time", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -859,14 +859,14 @@ ), IthoSensorEntityDescription( json_field="Free cooling starts", - translation_key="free_cooling_starts", + key="free_cooling_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Free cooling valve (%)", - translation_key="free_cooling_valve", + key="free_cooling_valve", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -874,27 +874,27 @@ ), IthoSensorEntityDescription( json_field="Gateway Time Receive", - translation_key="gateway_time_receive", + key="gateway_time_receive", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Heat demand thermost. (%)", - translation_key="heat_demand", + key="heat_demand", native_unit_of_measurement=PERCENTAGE, entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="HRU blowout flow (m3_h)", - translation_key="hru_blowout_flow", + key="hru_blowout_flow", native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="HRU blowout temp (°C)", - translation_key="hru_blowout_temp", + key="hru_blowout_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -902,7 +902,7 @@ ), IthoSensorEntityDescription( json_field="Heat demand total (%)", - translation_key="heat_demand_total", + key="heat_demand_total", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -910,13 +910,13 @@ ), IthoSensorEntityDescription( json_field="I error sourceflow", - translation_key="i_error_sourceflow", + key="i_error_sourceflow", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Latest valid source supply temp. (°C)", - translation_key="latest_valid_source_supply_temp", + key="latest_valid_source_supply_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -925,7 +925,7 @@ ), IthoSensorEntityDescription( json_field="Liquid temp (°C)", - translation_key="liquid_temp", + key="liquid_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -934,7 +934,7 @@ ), IthoSensorEntityDescription( json_field="Logging (sec)", - translation_key="logging", + key="logging", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -942,7 +942,7 @@ ), IthoSensorEntityDescription( json_field="Low pressure timer (sec)", - translation_key="low_pressure_timer", + key="low_pressure_timer", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -950,7 +950,7 @@ ), IthoSensorEntityDescription( json_field="Manual control (sec)", - translation_key="manual_control", + key="manual_control", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -958,7 +958,7 @@ ), IthoSensorEntityDescription( json_field="Max CV return temp (°C)", - translation_key="max_cv_return_temp", + key="max_cv_return_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -967,7 +967,7 @@ ), IthoSensorEntityDescription( json_field="Maximum time for preheating potable water (sec)", - translation_key="maximum_time_for_preheating_potable_water", + key="maximum_time_for_preheating_potable_water", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -975,7 +975,7 @@ ), IthoSensorEntityDescription( json_field="Min running time compr (sec)", - translation_key="min_running_time_compr", + key="min_running_time_compr", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -983,7 +983,7 @@ ), IthoSensorEntityDescription( json_field="Minimum release time external cooling (sec)", - translation_key="minimum_release_time_external_cooling", + key="minimum_release_time_external_cooling", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -991,7 +991,7 @@ ), IthoSensorEntityDescription( json_field="Minimum time for preheating potable water (sec)", - translation_key="minimum_time_for_preheating_potable_water", + key="minimum_time_for_preheating_potable_water", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -999,7 +999,7 @@ ), IthoSensorEntityDescription( json_field="Outside temp (°C)", - translation_key="outside_temp", + key="outside_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -1008,64 +1008,64 @@ ), IthoSensorEntityDescription( json_field="P source flow error", - translation_key="p_source_flow_error", + key="p_source_flow_error", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Phase detection", - translation_key="phase_detection", + key="phase_detection", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Pi error sourceflow", - translation_key="pi_error_sourceflow", + key="pi_error_sourceflow", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Preheat tap water", - translation_key="preheat_tap_water", + key="preheat_tap_water", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Pressure switch", - translation_key="pressure_switch", + key="pressure_switch", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Pulse counter", - translation_key="pulse_counter", + key="pulse_counter", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Requested room temp (°C)", - translation_key="requested_room_temp", + key="requested_room_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Reserve", - translation_key="reserve", + key="reserve", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Room temp (°C)", - translation_key="room_temp", + key="room_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Slow start well pump (sec)", - translation_key="slow_start_well_pump", + key="slow_start_well_pump", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1073,7 +1073,7 @@ ), IthoSensorEntityDescription( json_field="Source flow control period (sec)", - translation_key="source_flow_control_period", + key="source_flow_control_period", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1081,7 +1081,7 @@ ), IthoSensorEntityDescription( json_field="Source flow glycol compensation (l_h)", - translation_key="source_flow_glycol_compensation", + key="source_flow_glycol_compensation", native_unit_of_measurement="L/h", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1089,7 +1089,7 @@ ), IthoSensorEntityDescription( json_field="Source for _ nadraai (sec)", - translation_key="source_for_nadraai", + key="source_for_nadraai", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1097,7 +1097,7 @@ ), IthoSensorEntityDescription( json_field="Source pump flow setpoint (l_h)", - translation_key="source_pump_flow_setpoint", + key="source_pump_flow_setpoint", native_unit_of_measurement="L/h", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1105,7 +1105,7 @@ ), IthoSensorEntityDescription( json_field="Source pump on (h)", - translation_key="source_pump_on", + key="source_pump_on", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1113,7 +1113,7 @@ ), IthoSensorEntityDescription( json_field="Source pump speed at free cooling (%)", - translation_key="source_pump_speed_at_free_cooling", + key="source_pump_speed_at_free_cooling", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1121,21 +1121,21 @@ ), IthoSensorEntityDescription( json_field="Source pump speed free cooling mode", - translation_key="source_pump_speed_free_cooling_mode", + key="source_pump_speed_free_cooling_mode", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Source pump starts", - translation_key="source_pump_starts", + key="source_pump_starts", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Source return temperature too low (sec.)", - translation_key="source_return_temperature_too_low", + key="source_return_temperature_too_low", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1143,13 +1143,13 @@ ), IthoSensorEntityDescription( json_field="Spare input", - translation_key="spare_input", + key="spare_input", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Stabilisation waiting time-free cooling (sec.)", - translation_key="stabilisation_waiting_time_free_cooling", + key="stabilisation_waiting_time_free_cooling", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1157,17 +1157,17 @@ ), IthoSensorEntityDescription( json_field="Status", - translation_key="status", + key="status", ), IthoSensorEntityDescription( json_field="Sub_status", - translation_key="sub_status", + key="sub_status", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Suction gas temp (°C)", - translation_key="suction_gas_temp", + key="suction_gas_temp", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, @@ -1176,40 +1176,40 @@ ), IthoSensorEntityDescription( json_field="System starts", - translation_key="system_starts", + key="system_starts", state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Tariff", - translation_key="tariff", + key="tariff", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Tariff low from thermostat", - translation_key="tariff_low_from_thermostat", + key="tariff_low_from_thermostat", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Temp to source (°C)", - translation_key="temp_to_source", + key="temp_to_source", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Temp from source (°C)", - translation_key="temp_from_source", + key="temp_from_source", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Time CO valve start position (sec)", - translation_key="time_co_valve_start_position", + key="time_co_valve_start_position", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1217,7 +1217,7 @@ ), IthoSensorEntityDescription( json_field="time for error history (sec)", - translation_key="time_for_error_history", + key="time_for_error_history", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1225,7 +1225,7 @@ ), IthoSensorEntityDescription( json_field="Time hours (hrs)", - translation_key="time_hours", + key="time_hours", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1233,7 +1233,7 @@ ), IthoSensorEntityDescription( json_field="time seconds (sec)", - translation_key="time_seconds", + key="time_seconds", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1241,7 +1241,7 @@ ), IthoSensorEntityDescription( json_field="Time minutes (min)", - translation_key="time_minutes", + key="time_minutes", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1249,7 +1249,7 @@ ), IthoSensorEntityDescription( json_field="Total runtime (h)", - translation_key="total_runtime", + key="total_runtime", native_unit_of_measurement=UnitOfTime.HOURS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1257,19 +1257,19 @@ ), IthoSensorEntityDescription( json_field="Trickle heating", - translation_key="trickle_heating", + key="trickle_heating", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="UTC time", - translation_key="utc_time", + key="utc_time", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Utc Time offset (min)", - translation_key="utc_time_offset", + key="utc_time_offset", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1277,7 +1277,7 @@ ), IthoSensorEntityDescription( json_field="Waiting time permanently released element (sec)", - translation_key="waiting_time_permanently_released_element", + key="waiting_time_permanently_released_element", native_unit_of_measurement=UnitOfTime.SECONDS, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1285,19 +1285,19 @@ ), IthoSensorEntityDescription( json_field="Well pump (%)", - translation_key="well_pump_percent", + key="well_pump_percent", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), IthoSensorEntityDescription( json_field="Well pump prime", - translation_key="well_pump_prime", + key="well_pump_prime", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), IthoSensorEntityDescription( json_field="Well pump speed at airreg (%)", - translation_key="well_pump_speed_at_airreg", + key="well_pump_speed_at_airreg", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -1305,7 +1305,7 @@ ), IthoSensorEntityDescription( json_field="Well pump speed at compr (%)", - translation_key="well_pump_speed_at_compr", + key="well_pump_speed_at_compr", native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, diff --git a/custom_components/ithodaalderop/sensor.py b/custom_components/ithodaalderop/sensor.py index 98e76a6..a2fda56 100644 --- a/custom_components/ithodaalderop/sensor.py +++ b/custom_components/ithodaalderop/sensor.py @@ -11,11 +11,6 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback -from ._sensor_autotemp import IthoSensorAutotemp, IthoSensorAutotempRoom -from ._sensor_co2_remote import IthoSensorCO2Remote -from ._sensor_fan import IthoSensorFan -from ._sensor_last_command import IthoSensorLastCommand -from ._sensor_wpu import IthoSensorWPU from .const import ( _LOGGER, CONF_ADDON_TYPE, @@ -28,6 +23,7 @@ AUTOTEMP_DISTRIBUTOR_VALVE_SENSOR_TEMPLATE, AUTOTEMP_MALFUNCTION_VALVE_DECTECTION_DIST_SENSOR_TEMPLATE, AUTOTEMP_ROOM_SENSORS, + AUTOTEMP_SENSORS, AUTOTEMP_VALVE_SENSOR_TEMPLATE, ) from .definitions.co2_remote import REMOTE_SENSOR_TEMPLATE @@ -38,6 +34,11 @@ from .definitions.hrueco import HRU_ECO_SENSORS from .definitions.last_command import LAST_CMD_SENSORS from .definitions.wpu import WPU_ERROR_CODE_BYTE_TEMPLATE, WPU_SENSORS +from .sensor_autotemp import IthoSensorAutotemp, IthoSensorAutotempRoom +from .sensor_co2_remote import IthoSensorCO2Remote +from .sensor_fan import IthoSensorFan +from .sensor_last_command import IthoSensorLastCommand +from .sensor_wpu import IthoSensorWPU def _create_remotes(config_entry: ConfigEntry): @@ -49,7 +50,7 @@ def _create_remotes(config_entry: ConfigEntry): if remote not in ("", "Remote " + str(x)): sensor = copy.deepcopy(REMOTE_SENSOR_TEMPLATE) sensor.json_field = remote - sensor.key = f"{MQTT_BASETOPIC[config_entry.data[CONF_ADDON_TYPE]]}/{MQTT_STATETOPIC["remote"]}" + sensor.topic = f"{MQTT_BASETOPIC[config_entry.data[CONF_ADDON_TYPE]]}/{MQTT_STATETOPIC["remote"]}" sensor.translation_placeholders = {"remote_name": remote} sensor.unique_id = remote remotes.append(sensor) @@ -66,7 +67,7 @@ def _create_autotemprooms(config_entry: ConfigEntry): if room not in ("", "Room " + str(x)): for sensor in template_sensors: sensor.json_field = sensor.json_field.replace("X", str(x)) - sensor.key = ( + sensor.topic = ( f"{MQTT_BASETOPIC["autotemp"]}/{MQTT_STATETOPIC["autotemp"]}" ) sensor.room = room @@ -92,7 +93,7 @@ async def async_setup_entry( topic = f"{MQTT_BASETOPIC["autotemp"]}/{MQTT_STATETOPIC["autotemp"]}" for letter in ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"]: sensor = copy.deepcopy(AUTOTEMP_COMM_SPACE_SENSOR_TEMPLATE) - sensor.key = topic + sensor.topic = topic sensor.json_field = sensor.json_field.replace("X", letter) sensor.translation_placeholders = {"letter": letter} sensor.unique_id = sensor.unique_id_template.replace("x", letter) @@ -103,7 +104,7 @@ async def async_setup_entry( d = str(d) v = str(v) sensor = copy.deepcopy(AUTOTEMP_DISTRIBUTOR_VALVE_SENSOR_TEMPLATE) - sensor.key = topic + sensor.topic = topic sensor.json_field = sensor.json_field.replace("X", d).replace("Y", v) sensor.translation_placeholders = {"distributor": d, "valve": v} sensor.unique_id = sensor.unique_id_template.replace("x", d).replace( @@ -116,7 +117,7 @@ async def async_setup_entry( sensor = copy.deepcopy( AUTOTEMP_MALFUNCTION_VALVE_DECTECTION_DIST_SENSOR_TEMPLATE ) - sensor.key = topic + sensor.topic = topic sensor.json_field = sensor.json_field.replace("X", d) sensor.translation_placeholders = {"distributor": d} sensor.unique_id = sensor.unique_id_template.replace("x", d) @@ -126,17 +127,17 @@ async def async_setup_entry( v = str(v) template_sensors = copy.deepcopy(list(AUTOTEMP_VALVE_SENSOR_TEMPLATE)) for sensor in template_sensors: - sensor.key = topic + sensor.topic = topic sensor.json_field = sensor.json_field.replace("X", v) sensor.translation_placeholders = {"valve": v} sensor.unique_id = sensor.unique_id_template.replace("x", v) sensors.append(IthoSensorAutotemp(sensor, config_entry)) - # for description in AUTOTEMP_SENSORS: - # description.key = ( - # f"{MQTT_BASETOPIC["autotemp"]}/{MQTT_STATETOPIC["autotemp"]}" - # ) - # sensors.append(IthoSensorAutotemp(description, config_entry)) + for description in AUTOTEMP_SENSORS: + description.topic = ( + f"{MQTT_BASETOPIC["autotemp"]}/{MQTT_STATETOPIC["autotemp"]}" + ) + sensors.append(IthoSensorAutotemp(description, config_entry)) sensors.extend( [ @@ -149,7 +150,7 @@ async def async_setup_entry( topic = f"{MQTT_BASETOPIC["cve"]}/{MQTT_STATETOPIC["cve"]}" for description in CVE_SENSORS: - description.key = topic + description.topic = topic sensors.append(IthoSensorFan(description, config_entry)) if config_entry.data[CONF_ADDON_TYPE] == "noncve": @@ -165,7 +166,7 @@ async def async_setup_entry( hru_sensors = HRU_ECO_350_SENSORS for description in hru_sensors: - description.key = topic + description.topic = topic sensors.append(IthoSensorFan(description, config_entry)) if config_entry.data[CONF_ADDON_TYPE] in ["cve", "noncve"]: @@ -179,7 +180,7 @@ async def async_setup_entry( ) for description in LAST_CMD_SENSORS: - description.key = topic + description.topic = topic sensors.append(IthoSensorLastCommand(description, config_entry)) if config_entry.data[CONF_ADDON_TYPE] == "wpu": @@ -187,14 +188,14 @@ async def async_setup_entry( for x in range(6): x = str(x) sensor = copy.deepcopy(WPU_ERROR_CODE_BYTE_TEMPLATE) - sensor.key = topic + sensor.topic = topic sensor.json_field = sensor.json_field + x sensor.translation_placeholders = {"num": x} sensor.unique_id = sensor.unique_id_template.replace("x", x) sensors.append(IthoSensorWPU(sensor, config_entry)) for description in WPU_SENSORS: - description.key = topic + description.topic = topic sensors.append(IthoSensorWPU(description, config_entry)) async_add_entities(sensors) diff --git a/custom_components/ithodaalderop/_sensor_autotemp.py b/custom_components/ithodaalderop/sensor_autotemp.py similarity index 94% rename from custom_components/ithodaalderop/_sensor_autotemp.py rename to custom_components/ithodaalderop/sensor_autotemp.py index c7d2bb7..cdaf93c 100644 --- a/custom_components/ithodaalderop/_sensor_autotemp.py +++ b/custom_components/ithodaalderop/sensor_autotemp.py @@ -7,7 +7,6 @@ from homeassistant.core import callback from homeassistant.helpers.device_registry import DeviceInfo -from ._sensor_base import IthoBaseSensor from .const import ( ADDON_TYPES, AUTOTEMP_ERROR, @@ -17,6 +16,7 @@ MANUFACTURER, ) from .definitions.base import IthoSensorEntityDescription +from .sensor_base import IthoBaseSensor class IthoSensorAutotemp(IthoBaseSensor): @@ -68,7 +68,7 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) @@ -108,5 +108,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) diff --git a/custom_components/ithodaalderop/_sensor_base.py b/custom_components/ithodaalderop/sensor_base.py similarity index 94% rename from custom_components/ithodaalderop/_sensor_base.py rename to custom_components/ithodaalderop/sensor_base.py index 83a84a8..fd3e1c6 100644 --- a/custom_components/ithodaalderop/_sensor_base.py +++ b/custom_components/ithodaalderop/sensor_base.py @@ -32,6 +32,7 @@ def __init__( ) -> None: """Initialize the sensor.""" self.entity_description = description + self.entity_description.translation_key = self.entity_description.key if use_base_sensor_device: model = ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]] @@ -50,7 +51,7 @@ def __init__( if description.unique_id is not None: self._attr_unique_id = f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.unique_id.lower()}" else: - self._attr_unique_id = f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.translation_key}" + self._attr_unique_id = f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.key}" self.entity_id = f"sensor.{self._attr_unique_id}" @property diff --git a/custom_components/ithodaalderop/_sensor_co2_remote.py b/custom_components/ithodaalderop/sensor_co2_remote.py similarity index 91% rename from custom_components/ithodaalderop/_sensor_co2_remote.py rename to custom_components/ithodaalderop/sensor_co2_remote.py index f7d67a9..93553e9 100644 --- a/custom_components/ithodaalderop/_sensor_co2_remote.py +++ b/custom_components/ithodaalderop/sensor_co2_remote.py @@ -6,8 +6,8 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback -from ._sensor_base import IthoBaseSensor from .definitions.base import IthoSensorEntityDescription +from .sensor_base import IthoBaseSensor class IthoSensorCO2Remote(IthoBaseSensor): @@ -38,5 +38,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) diff --git a/custom_components/ithodaalderop/_sensor_fan.py b/custom_components/ithodaalderop/sensor_fan.py similarity index 97% rename from custom_components/ithodaalderop/_sensor_fan.py rename to custom_components/ithodaalderop/sensor_fan.py index 73ea88c..6049bd4 100644 --- a/custom_components/ithodaalderop/_sensor_fan.py +++ b/custom_components/ithodaalderop/sensor_fan.py @@ -7,7 +7,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback -from ._sensor_base import IthoBaseSensor from .const import ( HRU_ECO_250_300_ERROR_CODE, HRU_ECO_350_ACTUAL_MODE, @@ -16,6 +15,7 @@ HRU_ECO_STATUS, ) from .definitions.base import IthoSensorEntityDescription +from .sensor_base import IthoBaseSensor class IthoSensorFan(IthoBaseSensor): @@ -138,5 +138,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) diff --git a/custom_components/ithodaalderop/_sensor_last_command.py b/custom_components/ithodaalderop/sensor_last_command.py similarity index 90% rename from custom_components/ithodaalderop/_sensor_last_command.py rename to custom_components/ithodaalderop/sensor_last_command.py index 353546d..058b228 100644 --- a/custom_components/ithodaalderop/_sensor_last_command.py +++ b/custom_components/ithodaalderop/sensor_last_command.py @@ -6,8 +6,8 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback -from ._sensor_base import IthoBaseSensor from .definitions.base import IthoSensorEntityDescription +from .sensor_base import IthoBaseSensor class IthoSensorLastCommand(IthoBaseSensor): @@ -32,5 +32,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 ) diff --git a/custom_components/ithodaalderop/_sensor_wpu.py b/custom_components/ithodaalderop/sensor_wpu.py similarity index 94% rename from custom_components/ithodaalderop/_sensor_wpu.py rename to custom_components/ithodaalderop/sensor_wpu.py index 6fcdd32..95bf35e 100644 --- a/custom_components/ithodaalderop/_sensor_wpu.py +++ b/custom_components/ithodaalderop/sensor_wpu.py @@ -6,9 +6,9 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import callback -from ._sensor_base import IthoBaseSensor from .const import WPU_STATUS from .definitions.base import IthoSensorEntityDescription +from .sensor_base import IthoBaseSensor class IthoSensorWPU(IthoBaseSensor): @@ -55,5 +55,5 @@ def message_received(message): self.async_write_ha_state() await mqtt.async_subscribe( - self.hass, self.entity_description.key, message_received, 1 + self.hass, self.entity_description.topic, message_received, 1 )