From 13a27eec9073e77a16f0162c27af66c030c75c9e Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Tue, 4 May 2021 23:45:25 +0200 Subject: [PATCH] Fix KNX climate unque_id (#50054) --- homeassistant/components/knx/climate.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index de9b71a2287..aec587c9d0e 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -67,7 +67,24 @@ def _async_migrate_unique_id( ga_target_temperature_state = parse_device_group_address( entity_config[ClimateSchema.CONF_TARGET_TEMPERATURE_STATE_ADDRESS][0] ) - new_uid = f"{ga_temperature_state}_{ga_target_temperature_state}" + target_temp = entity_config.get(ClimateSchema.CONF_TARGET_TEMPERATURE_ADDRESS) + ga_target_temperature = ( + parse_device_group_address(target_temp[0]) + if target_temp is not None + else None + ) + setpoint_shift = entity_config.get(ClimateSchema.CONF_SETPOINT_SHIFT_ADDRESS) + ga_setpoint_shift = ( + parse_device_group_address(setpoint_shift[0]) + if setpoint_shift is not None + else None + ) + new_uid = ( + f"{ga_temperature_state}_" + f"{ga_target_temperature_state}_" + f"{ga_target_temperature}_" + f"{ga_setpoint_shift}" + ) entity_registry.async_update_entity(entity_id, new_unique_id=new_uid) @@ -80,7 +97,9 @@ class KNXClimate(KnxEntity, ClimateEntity): super().__init__(device) self._unique_id = ( f"{device.temperature.group_address_state}_" - f"{device.target_temperature.group_address_state}" + f"{device.target_temperature.group_address_state}_" + f"{device.target_temperature.group_address}_" + f"{device._setpoint_shift.group_address}" # pylint: disable=protected-access ) self._unit_of_measurement = TEMP_CELSIUS