diff --git a/custom_components/askoheat/api_conf_desc.py b/custom_components/askoheat/api_conf_desc.py index 612c7cc..de2f167 100644 --- a/custom_components/askoheat/api_conf_desc.py +++ b/custom_components/askoheat/api_conf_desc.py @@ -27,6 +27,7 @@ ) from custom_components.askoheat.const import ( Baudrate, + DeviceKey, EnergyMeterType, NumberAttrKey, SelectAttrKey, @@ -48,6 +49,7 @@ number_inputs=[ AskoheatNumberEntityDescription( key=NumberAttrKey.CON_RELAY_SEC_COUNT_SECONDS, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=16, native_default_value=5, @@ -59,6 +61,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_PUMP_SEC_COUNT_SECONDS, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=240, native_default_value=30, @@ -70,6 +73,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_AUTO_HEATER_OFF_MINUTES, + device_key=DeviceKey.WATER_BOILER, native_min_value=2, native_max_value=10080, native_unit_of_measurement=UnitOfTime.MINUTES, @@ -80,6 +84,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_CASCADE_PRIORIZATION, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=255, entity_category=EntityCategory.CONFIG, @@ -89,6 +94,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_HEATBUFFER_VOLUME, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=1000, native_unit_of_measurement=UnitOfVolume.LITERS, @@ -99,6 +105,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LEGIO_PROTECTION_TEMPERATURE, + device_key=DeviceKey.LEGIO_PROTECTION, native_min_value=50, native_max_value=65, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -109,6 +116,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LEGIO_PROTECTION_HEATUP_MINUTES, + device_key=DeviceKey.LEGIO_PROTECTION, native_min_value=0, native_max_value=1440, native_default_value=240, @@ -120,6 +128,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_NUMBER_OF_HOUSEHOLD_MEMBERS, + device_key=DeviceKey.WATER_BOILER, native_min_value=1, native_max_value=255, entity_category=EntityCategory.CONFIG, @@ -129,6 +138,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LOAD_FEEDIN_DELAY_SECONDS, + device_key=DeviceKey.ENERGY_MANAGER, native_min_value=0, native_max_value=120, native_unit_of_measurement=UnitOfTime.SECONDS, @@ -139,6 +149,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LOAD_FEEDIN_BASIC_ENERGY_LEVEL, + device_key=DeviceKey.ENERGY_MANAGER, native_min_value=0, native_max_value=10000, native_unit_of_measurement=UnitOfPower.WATT, @@ -149,6 +160,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_TIMEZONE_OFFSET, + device_key=DeviceKey.WATER_BOILER, native_min_value=-12, native_max_value=12, entity_category=EntityCategory.CONFIG, @@ -158,6 +170,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_RTU_SLAVE_ID, + device_key=DeviceKey.ENERGY_MANAGER, native_min_value=0, native_max_value=240, entity_category=EntityCategory.CONFIG, @@ -167,6 +180,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_HYSTERESIS, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -176,6 +190,7 @@ # Analog 0 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_0_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -184,6 +199,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_0_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -195,6 +211,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_0_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -206,6 +223,7 @@ # Analog 1 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_1_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -214,6 +232,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_1_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -225,6 +244,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_1_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -236,6 +256,7 @@ # Analog 2 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_2_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -244,6 +265,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_2_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -255,6 +277,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_2_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -266,6 +289,7 @@ # Analog 3 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_3_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -274,6 +298,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_3_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -285,6 +310,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_3_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -296,6 +322,7 @@ # Analog 4 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_4_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -304,6 +331,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_4_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -315,6 +343,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_4_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -326,6 +355,7 @@ # Analog 5 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_5_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -334,6 +364,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_5_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -345,6 +376,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_5_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -356,6 +388,7 @@ # Analog 6 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_6_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -364,6 +397,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_6_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -375,6 +409,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_6_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -386,6 +421,7 @@ # Analog 7 AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_7_THRESHOLD, + device_key=DeviceKey.ANALOG_INPUT, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.CONFIG, mode=NumberMode.BOX, @@ -394,6 +430,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_7_THRESHOLD_STEP, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=7, native_step=1, @@ -405,6 +442,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_ANALOG_INPUT_7_THRESHOLD_TEMPERATURE, + device_key=DeviceKey.ANALOG_INPUT, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -415,6 +453,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_HEAT_PUMP_REQUEST_OFF_STEP, + device_key=DeviceKey.HEAT_PUMP, native_min_value=0, native_max_value=7, native_step=1, @@ -425,6 +464,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_HEAT_PUMP_REQUEST_ON_STEP, + device_key=DeviceKey.HEAT_PUMP, native_min_value=0, native_max_value=7, native_step=1, @@ -434,7 +474,8 @@ api_descriptor=ByteRegisterInputDescriptor(91), ), AskoheatNumberEntityDescription( - key=NumberAttrKey.CON_EMERGENCY_MODE_ON_STOP, + key=NumberAttrKey.CON_EMERGENCY_MODE_ON_STEP, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=7, native_step=1, @@ -445,6 +486,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_TEMPERATURE_HYSTERESIS, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -455,6 +497,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_MINIMAL_TEMPERATURE, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -465,6 +508,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_SET_HEATER_STEP_TEMPERATURE_LIMIT, + device_key=DeviceKey.ENERGY_MANAGER, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -475,6 +519,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LOAD_FEEDIN_OR_SETPOINT_TEMPERATURE_LIMIT, + device_key=DeviceKey.ENERGY_MANAGER, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -485,6 +530,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_LOW_TARIFF_TEMPERATURE_LIMIT, + device_key=DeviceKey.WATER_BOILER, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -495,6 +541,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.CON_HEATPUMP_REQUEST_TEMPERATURE_LIMIT, + device_key=DeviceKey.HEAT_PUMP, native_min_value=0, native_max_value=95, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -509,48 +556,56 @@ # low byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_MISSING_CURRENT_FLOW_TRIGGERS_ERROR, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:alert-circle", api_descriptor=FlagRegisterInputDescriptor(2, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATER_LOAD_VALUE_ONLY_IF_CURRENT_FLOWS, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:home-lightning-bolt", api_descriptor=FlagRegisterInputDescriptor(2, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LOAD_FEEDIN_VALUE_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:solar-power", api_descriptor=FlagRegisterInputDescriptor(2, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LOAD_SETPOINT_VALUE_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:stairs", api_descriptor=FlagRegisterInputDescriptor(2, 3), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_SET_HEATER_STEP_VALUE_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:gauge", api_descriptor=FlagRegisterInputDescriptor(2, 4), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_SET_ANALOG_INPUT_ENABLED, + device_key=DeviceKey.ANALOG_INPUT, entity_category=EntityCategory.CONFIG, icon="mdi:since-wave", api_descriptor=FlagRegisterInputDescriptor(2, 5), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATPUMP_REQUEST_INPUT_ENABLED, + device_key=DeviceKey.HEAT_PUMP, entity_category=EntityCategory.CONFIG, icon="mdi:heat-pump", api_descriptor=FlagRegisterInputDescriptor(2, 6), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_EMERGENCY_MODE_ENABLED, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:car-emergency", api_descriptor=FlagRegisterInputDescriptor(2, 7), @@ -558,18 +613,21 @@ # high byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LOW_TARIFF_OPTION_ENABLED, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:weather-night", api_descriptor=FlagRegisterInputDescriptor(2, 8), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HOLD_MINIMAL_TEMPERATURE_ENABLED, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-check", api_descriptor=FlagRegisterInputDescriptor(2, 9), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_SOFTWARE_CONTROL_SMA_SEMP_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:car-cruise-control", api_descriptor=FlagRegisterInputDescriptor(2, 10), @@ -577,6 +635,7 @@ ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_SOFTWARE_CONTROL_SENEC_HOME_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:car-cruise-control", api_descriptor=FlagRegisterInputDescriptor(2, 11), @@ -587,12 +646,14 @@ # low byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_AUTO_OFF_MODBUS_TIMEOUT_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RESTART_IF_ENERGYMANAGER_CONNECTION_LOST, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 1), @@ -601,12 +662,14 @@ # bit 3 not used AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_AUTO_OFF_MODBUS_ENABLED, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 4), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_AUTO_OFF_ANALOG_INPUT_ENABLED, + device_key=DeviceKey.ANALOG_INPUT, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 5), @@ -614,12 +677,14 @@ ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_AUTO_OFF_HEAT_PUMP_REQUEST_ENABLED, + device_key=DeviceKey.HEAT_PUMP, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 6), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_AUTO_OFF_EMERGENCY_MODE_ENABLED, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-cancel", api_descriptor=FlagRegisterInputDescriptor(4, 7), @@ -628,24 +693,28 @@ ### heatbuffer type register - begin AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_TAP_WATER, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_HEATING_WATER, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_COMBINED_HEAT_AND_POWER_UNIT, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_PELLET_FIRING, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 3), @@ -653,6 +722,7 @@ ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_GAS_BURNER, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 4), @@ -660,6 +730,7 @@ ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_OIL_BURNER, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 5), @@ -667,12 +738,14 @@ ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_HEAT_PUMP, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 6), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATBUFFER_TYPE_OTHER, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:water-boiler", api_descriptor=FlagRegisterInputDescriptor(6, 7), @@ -681,18 +754,21 @@ ### heater position register - begin AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATER_POSITION_BOTTOM, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:format-vertical-align-bottom", api_descriptor=FlagRegisterInputDescriptor(8, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATER_POSITION_MIDDLE, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:format-vertical-align-center", api_descriptor=FlagRegisterInputDescriptor(8, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HEATER_POSITION_ASKOWALL, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:wall", api_descriptor=FlagRegisterInputDescriptor(8, 7), @@ -702,30 +778,35 @@ # low byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_USE_INTERNAL_TEMP_SENSOR, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:water-thermometer", api_descriptor=FlagRegisterInputDescriptor(9, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_USE_EXTERNAL_TEMP_SENSOR1, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:water-thermometer", api_descriptor=FlagRegisterInputDescriptor(9, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_USE_EXTERNAL_TEMP_SENSOR2, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:water-thermometer", api_descriptor=FlagRegisterInputDescriptor(9, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_USE_EXTERNAL_TEMP_SENSOR3, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:water-thermometer", api_descriptor=FlagRegisterInputDescriptor(9, 3), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_USE_EXTERNAL_TEMP_SENSOR4, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:water-thermometer", api_descriptor=FlagRegisterInputDescriptor(9, 4), @@ -733,36 +814,42 @@ # high byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_INTERVAL_DAILY, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:home-clock", api_descriptor=FlagRegisterInputDescriptor(9, 8), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_INTERVAL_WEEKLY, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:home-clock", api_descriptor=FlagRegisterInputDescriptor(9, 9), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_INTERVAL_FORTNIGHTLY, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:home-clock", api_descriptor=FlagRegisterInputDescriptor(9, 10), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_INTERVAL_MONTHLY, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:home-clock", api_descriptor=FlagRegisterInputDescriptor(9, 11), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_PREFER_FEEDIN_ENERGY, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:solar-power", api_descriptor=FlagRegisterInputDescriptor(9, 12), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_LEGIO_SETTINGS_PROTECTION_ENABLED, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:shield-sun", api_descriptor=FlagRegisterInputDescriptor(9, 13), @@ -771,24 +858,28 @@ ### house type settings register - begin AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HOUSE_TYPE_SINGLE_FAMILY_HOUSE, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:home", api_descriptor=FlagRegisterInputDescriptor(20, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HOUSE_TYPE_TWO_FAMILY_HOUSE, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:home-group", api_descriptor=FlagRegisterInputDescriptor(20, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HOUSE_TYPE_APPARTMENT_BUILDING, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:floor-plan", api_descriptor=FlagRegisterInputDescriptor(20, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_HOUSE_TYPE_COMMERCIAL_BUILDING, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:office-building", api_descriptor=FlagRegisterInputDescriptor(20, 7), @@ -797,6 +888,7 @@ ### is Summer time int 1/0 as bool, 1 hour offset AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_SUMMER_TIME, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:calendar-clock", api_descriptor=ByteRegisterInputDescriptor(42), @@ -805,24 +897,28 @@ # low byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RTU_SEND_TWO_STOP_BITS, + device_key=DeviceKey.MODBUS_MASTER, entity_category=EntityCategory.CONFIG, icon="mdi:protocol", api_descriptor=FlagRegisterInputDescriptor(49, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RTU_SEND_PARITY_EVEN, + device_key=DeviceKey.MODBUS_MASTER, entity_category=EntityCategory.CONFIG, icon="mdi:protocol", api_descriptor=FlagRegisterInputDescriptor(49, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RTU_SEND_PARITY_ODD, + device_key=DeviceKey.MODBUS_MASTER, entity_category=EntityCategory.CONFIG, icon="mdi:protocol", api_descriptor=FlagRegisterInputDescriptor(49, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RTU_SLAVE_MODE_ACTIVE, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:protocol", api_descriptor=FlagRegisterInputDescriptor(49, 7), @@ -830,6 +926,7 @@ # high byte AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_RTU_MASTER_MODE_ACTIVE, + device_key=DeviceKey.MODBUS_MASTER, entity_category=EntityCategory.CONFIG, icon="mdi:protocol", api_descriptor=FlagRegisterInputDescriptor(49, 15), @@ -838,30 +935,35 @@ ### temperature settings register - begin AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_USE_INTERNAL_TEMP_SENSOR, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-water", api_descriptor=FlagRegisterInputDescriptor(94, 0), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_USE_EXTERNAL_TEMP_SENSOR1, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-water", api_descriptor=FlagRegisterInputDescriptor(94, 1), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_USE_EXTERNAL_TEMP_SENSOR2, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-water", api_descriptor=FlagRegisterInputDescriptor(94, 2), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_USE_EXTERNAL_TEMP_SENSOR3, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-water", api_descriptor=FlagRegisterInputDescriptor(94, 3), ), AskoheatSwitchEntityDescription( key=SwitchAttrKey.CON_USE_EXTERNAL_TEMP_SENSOR4, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:thermometer-water", api_descriptor=FlagRegisterInputDescriptor(94, 4), @@ -871,18 +973,21 @@ time_inputs=[ AskoheatTimeEntityDescription( key=TimeAttrKey.CON_LEGIO_PROTECTION_PREFERRED_START_TIME, + device_key=DeviceKey.LEGIO_PROTECTION, entity_category=EntityCategory.CONFIG, icon="mdi:timer-play", api_descriptor=TimeRegisterInputDescriptor(12), ), AskoheatTimeEntityDescription( key=TimeAttrKey.CON_LOW_TARIFF_START_TIME, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-play", api_descriptor=TimeRegisterInputDescriptor(52), ), AskoheatTimeEntityDescription( key=TimeAttrKey.CON_LOW_TARIFF_END_TIME, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, icon="mdi:timer-remove", api_descriptor=TimeRegisterInputDescriptor(54), @@ -891,6 +996,7 @@ text_inputs=[ AskoheatTextEntityDescription( key=TextAttrKey.CON_INFO_STRING, + device_key=DeviceKey.WATER_BOILER, entity_category=EntityCategory.CONFIG, native_max=32, icon="mdi:information", @@ -902,6 +1008,7 @@ select_inputs=[ AskoheatSelectEntityDescription( key=SelectAttrKey.CON_RTU_BAUDRATE, + device_key=DeviceKey.MODBUS_MASTER, entity_category=EntityCategory.CONFIG, icon="mdi:speedometer", api_descriptor=StrEnumInputDescriptor( @@ -913,6 +1020,7 @@ ), AskoheatSelectEntityDescription( key=SelectAttrKey.CON_ENERGY_METER_TYPE, + device_key=DeviceKey.ENERGY_MANAGER, entity_category=EntityCategory.CONFIG, icon="mdi:list-box", api_descriptor=IntEnumInputDescriptor( diff --git a/custom_components/askoheat/api_ema_desc.py b/custom_components/askoheat/api_ema_desc.py index 145ca88..9a7f0f7 100644 --- a/custom_components/askoheat/api_ema_desc.py +++ b/custom_components/askoheat/api_ema_desc.py @@ -25,6 +25,7 @@ ) from custom_components.askoheat.const import ( BinarySensorAttrKey, + DeviceKey, NumberAttrKey, SensorAttrKey, ) @@ -40,30 +41,35 @@ binary_sensors=[ AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.HEATER1_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:power-plug", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=0), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.HEATER2_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:power-plug", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=1), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.HEATER3_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:power-plug", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=2), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.PUMP_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=3), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.RELAY_BOARD_CONNECTED, + device_key=DeviceKey.WATER_BOILER, icon="mdi:connection", device_class=BinarySensorDeviceClass.PROBLEM, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=4), @@ -71,42 +77,49 @@ # bit 5 ignored AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.HEAT_PUMP_REQUEST_ACTIVE, + device_key=DeviceKey.HEAT_PUMP, icon="mdi:heat-pump", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=6), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.EMERGENCY_MODE_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:car-emergency", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=7), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.LEGIONELLA_PROTECTION_ACTIVE, + device_key=DeviceKey.LEGIO_PROTECTION, icon="mdi:shield-sun", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=8), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.ANALOG_INPUT_ACTIVE, + device_key=DeviceKey.ANALOG_INPUT, icon="mdi:sine-wave", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=9), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.SETPOINT_ACTIVE, + device_key=DeviceKey.ENERGY_MANAGER, icon="mdi:finance", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=10), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.LOAD_FEEDIN_ACTIVE, + device_key=DeviceKey.ENERGY_MANAGER, icon="mdi:solar-power", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=11), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.AUTOHEATER_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:water-boiler-auto", inverted=True, device_class=BinarySensorDeviceClass.RUNNING, @@ -114,18 +127,21 @@ ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.PUMP_RELAY_FOLLOW_UP_TIME_ACTIVE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:water-boiler-auto", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=13), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.TEMP_LIMIT_REACHED, + device_key=DeviceKey.WATER_BOILER, icon="mdi:water-boiler-auto", device_class=BinarySensorDeviceClass.RUNNING, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=14), ), AskoheatBinarySensorEntityDescription( key=BinarySensorAttrKey.ERROR_OCCURED, + device_key=DeviceKey.WATER_BOILER, icon="mdi:water-thermometer", device_class=BinarySensorDeviceClass.PROBLEM, api_descriptor=FlagRegisterInputDescriptor(starting_register=16, bit=15), @@ -134,6 +150,7 @@ sensors=[ AskoheatSensorEntityDescription( key=SensorAttrKey.HEATER_LOAD, + device_key=DeviceKey.WATER_BOILER, icon="mdi:lightning-bolt", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.POWER, @@ -143,6 +160,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.ANALOG_INPUT_VALUE, + device_key=DeviceKey.ANALOG_INPUT, icon="mdi:gauge", native_precision=0, state_class=SensorStateClass.MEASUREMENT, @@ -153,6 +171,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.INTERNAL_TEMPERATUR_SENSOR_VALUE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:thermometer", native_precision=1, state_class=SensorStateClass.MEASUREMENT, @@ -163,6 +182,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.EXTERNAL_TEMPERATUR_SENSOR1_VALUE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:thermometer", native_precision=1, state_class=SensorStateClass.MEASUREMENT, @@ -173,6 +193,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.EXTERNAL_TEMPERATUR_SENSOR2_VALUE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:thermometer", native_precision=1, state_class=SensorStateClass.MEASUREMENT, @@ -183,6 +204,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.EXTERNAL_TEMPERATUR_SENSOR3_VALUE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:thermometer", native_precision=1, state_class=SensorStateClass.MEASUREMENT, @@ -193,6 +215,7 @@ ), AskoheatSensorEntityDescription( key=SensorAttrKey.EXTERNAL_TEMPERATUR_SENSOR4_VALUE, + device_key=DeviceKey.WATER_BOILER, icon="mdi:thermometer", native_precision=1, state_class=SensorStateClass.MEASUREMENT, @@ -205,6 +228,7 @@ number_inputs=[ AskoheatNumberEntityDescription( key=NumberAttrKey.SET_HEADER_STEP_VALUE, + device_key=DeviceKey.ENERGY_MANAGER, icon="mdi:lightning-bolt", native_min_value=0, native_max_value=7, @@ -215,6 +239,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.LOAD_SETPOINT_VALUE, + device_key=DeviceKey.ENERGY_MANAGER, icon="mdi:lightning-bolt", native_min_value=250, native_max_value=30000, @@ -225,6 +250,7 @@ ), AskoheatNumberEntityDescription( key=NumberAttrKey.LOAD_FEEDIN_VALUE, + device_key=DeviceKey.ENERGY_MANAGER, icon="mdi:solar-power", native_min_value=-30000, native_max_value=30000, diff --git a/custom_components/askoheat/const.py b/custom_components/askoheat/const.py index 2932fb6..946ce4c 100644 --- a/custom_components/askoheat/const.py +++ b/custom_components/askoheat/const.py @@ -106,7 +106,7 @@ class NumberAttrKey(StrEnum): # 0-7 CON_HEAT_PUMP_REQUEST_ON_STEP = "heat_pump_request_on_step" # 0-7 - CON_EMERGENCY_MODE_ON_STOP = "emergency_mode_on_step" + CON_EMERGENCY_MODE_ON_STEP = "emergency_mode_on_step" # 0-95 degree CON_TEMPERATURE_HYSTERESIS = "temperature_hysteresis" @@ -334,3 +334,14 @@ class EnergyMeterType(IntEnum): EM_AUTOMATION_ONE_TYPE_A1EM_BIMOD = 0x001 EM_AUTOMATION_ONE_TYPE_A1EM_MOD = 0x02 EM300 = 0x010 + + +class DeviceKey(StrEnum): + """Device keys.""" + + MODBUS_MASTER = "modbus_master" + HEAT_PUMP = "heat_pump" + ANALOG_INPUT = "analog_input" + ENERGY_MANAGER = "energy_manager" + WATER_BOILER = "water_boiler" + LEGIO_PROTECTION = "legio_protection" diff --git a/custom_components/askoheat/entity.py b/custom_components/askoheat/entity.py index 538835c..e7e80f6 100644 --- a/custom_components/askoheat/entity.py +++ b/custom_components/askoheat/entity.py @@ -10,7 +10,7 @@ from custom_components.askoheat.model import AskoheatEntityDescription -from .const import ATTRIBUTION +from .const import ATTRIBUTION, DeviceKey from .coordinator import AskoheatDataUpdateCoordinator E = TypeVar("E", bound=AskoheatEntityDescription) @@ -34,9 +34,11 @@ def __init__( identifiers={ ( coordinator.config_entry.domain, - coordinator.config_entry.entry_id, + f"{entity_description.device_key}.{coordinator.config_entry.entry_id}", ), }, + translation_key=entity_description.device_key, # type: ignore # noqa: PGH003 + via_device=(coordinator.config_entry.domain, DeviceKey.WATER_BOILER), ) self.entity_description = entity_description self.translation_key = ( diff --git a/custom_components/askoheat/model.py b/custom_components/askoheat/model.py index da442c6..d5e1ee8 100644 --- a/custom_components/askoheat/model.py +++ b/custom_components/askoheat/model.py @@ -32,6 +32,7 @@ from custom_components.askoheat.const import ( DOMAIN, BinarySensorAttrKey, + DeviceKey, NumberAttrKey, SelectAttrKey, SensorAttrKey, @@ -56,6 +57,7 @@ class AskoheatEntityDescription[K, A](EntityDescription): key: K api_descriptor: A | None = None icon_by_state: dict[date | datetime | Decimal, str] | None = None + device_key: DeviceKey | None = None @dataclass(frozen=True)