From 5f8646600fae63b8afca3ecd7986ac5fcc257ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Fri, 19 Nov 2021 23:19:56 +0100 Subject: [PATCH] Correct supported_features and model for Mill (#59996) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Correct supported_features and model for Mill Signed-off-by: Daniel Hjelseth Høyer * Correct supported_features and model for Mill Signed-off-by: Daniel Hjelseth Høyer * revert Signed-off-by: Daniel Hjelseth Høyer * Mill Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/mill/climate.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index 80611cf9f96..91ba10618f0 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -86,7 +86,6 @@ class MillHeater(CoordinatorEntity, ClimateEntity): _attr_fan_modes = [FAN_ON, HVAC_MODE_OFF] _attr_max_temp = MAX_TEMP _attr_min_temp = MIN_TEMP - _attr_supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE _attr_target_temperature_step = PRECISION_WHOLE _attr_temperature_unit = TEMP_CELSIUS @@ -103,13 +102,21 @@ class MillHeater(CoordinatorEntity, ClimateEntity): self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, heater.device_id)}, manufacturer=MANUFACTURER, - model=f"generation {1 if heater.is_gen1 else 2}", + model=f"Generation {heater.generation}", name=self.name, ) if heater.is_gen1 or heater.is_gen3: self._attr_hvac_modes = [HVAC_MODE_HEAT] else: self._attr_hvac_modes = [HVAC_MODE_HEAT, HVAC_MODE_OFF] + + if heater.generation < 3: + self._attr_supported_features = ( + SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE + ) + else: + self._attr_supported_features = SUPPORT_TARGET_TEMPERATURE + self._update_attr(heater) async def async_set_temperature(self, **kwargs): @@ -162,7 +169,7 @@ class MillHeater(CoordinatorEntity, ClimateEntity): "open_window": heater.open_window, "heating": heater.is_heating, "controlled_by_tibber": heater.tibber_control, - "heater_generation": 1 if heater.is_gen1 else 2, + "heater_generation": heater.generation, } if heater.room: self._attr_extra_state_attributes["room"] = heater.room.name