diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index f1487ed59f1..1e578087b73 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -5,8 +5,6 @@ import mill import voluptuous as vol from homeassistant.components.climate import ( - FAN_OFF, - FAN_ON, ClimateEntity, ClimateEntityFeature, HVACAction, @@ -18,7 +16,7 @@ from homeassistant.const import ( CONF_IP_ADDRESS, CONF_USERNAME, PRECISION_HALVES, - PRECISION_WHOLE, + PRECISION_TENTHS, UnitOfTemperature, ) from homeassistant.core import HomeAssistant, ServiceCall, callback @@ -90,11 +88,13 @@ async def async_setup_entry( class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): """Representation of a Mill Thermostat device.""" - _attr_fan_modes = [FAN_ON, FAN_OFF] _attr_has_entity_name = True + _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] _attr_max_temp = MAX_TEMP _attr_min_temp = MIN_TEMP _attr_name = None + _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE + _attr_target_temperature_step = PRECISION_TENTHS _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__( @@ -111,22 +111,9 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, heater.device_id)}, manufacturer=MANUFACTURER, - model=f"Generation {heater.generation}", + model=heater.model, name=heater.name, ) - if heater.is_gen1: - self._attr_hvac_modes = [HVACMode.HEAT] - else: - self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] - - if heater.generation < 3: - self._attr_supported_features = ( - ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE - ) - self._attr_target_temperature_step = PRECISION_WHOLE - else: - self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - self._attr_target_temperature_step = PRECISION_HALVES self._update_attr(heater) @@ -139,26 +126,16 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): ) await self.coordinator.async_request_refresh() - async def async_set_fan_mode(self, fan_mode: str) -> None: - """Set new target fan mode.""" - fan_status = 1 if fan_mode == FAN_ON else 0 - await self.coordinator.mill_data_connection.heater_control( - self._id, fan_status=fan_status - ) - await self.coordinator.async_request_refresh() - async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target hvac mode.""" - heater = self.coordinator.data[self._id] - if hvac_mode == HVACMode.HEAT: await self.coordinator.mill_data_connection.heater_control( - self._id, power_status=1 + self._id, power_status=True ) await self.coordinator.async_request_refresh() - elif hvac_mode == HVACMode.OFF and not heater.is_gen1: + elif hvac_mode == HVACMode.OFF: await self.coordinator.mill_data_connection.heater_control( - self._id, power_status=0 + self._id, power_status=False ) await self.coordinator.async_request_refresh() @@ -178,23 +155,20 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): self._available = heater.available self._attr_extra_state_attributes = { "open_window": heater.open_window, - "heating": heater.is_heating, "controlled_by_tibber": heater.tibber_control, - "heater_generation": heater.generation, } - if heater.room: - self._attr_extra_state_attributes["room"] = heater.room.name - self._attr_extra_state_attributes["avg_room_temp"] = heater.room.avg_temp + if heater.room_name: + self._attr_extra_state_attributes["room"] = heater.room_name + self._attr_extra_state_attributes["avg_room_temp"] = heater.room_avg_temp else: self._attr_extra_state_attributes["room"] = "Independent device" self._attr_target_temperature = heater.set_temp self._attr_current_temperature = heater.current_temp - self._attr_fan_mode = FAN_ON if heater.fan_status == 1 else HVACMode.OFF - if heater.is_heating == 1: + if heater.is_heating: self._attr_hvac_action = HVACAction.HEATING else: self._attr_hvac_action = HVACAction.IDLE - if heater.is_gen1 or heater.power_status == 1: + if heater.power_status: self._attr_hvac_mode = HVACMode.HEAT else: self._attr_hvac_mode = HVACMode.OFF diff --git a/homeassistant/components/mill/manifest.json b/homeassistant/components/mill/manifest.json index 0666c1107ca..66a358648fd 100644 --- a/homeassistant/components/mill/manifest.json +++ b/homeassistant/components/mill/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/mill", "iot_class": "local_polling", "loggers": ["mill", "mill_local"], - "requirements": ["millheater==0.10.0", "mill-local==0.2.0"] + "requirements": ["millheater==0.11.0", "mill-local==0.2.0"] } diff --git a/homeassistant/components/mill/sensor.py b/homeassistant/components/mill/sensor.py index a915418bb93..843e8b6570e 100644 --- a/homeassistant/components/mill/sensor.py +++ b/homeassistant/components/mill/sensor.py @@ -172,13 +172,10 @@ class MillSensor(CoordinatorEntity, SensorEntity): self._attr_unique_id = f"{mill_device.device_id}_{entity_description.key}" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, mill_device.device_id)}, - name=self.name, + name=mill_device.name, manufacturer=MANUFACTURER, + model=mill_device.model, ) - if isinstance(mill_device, mill.Heater): - self._attr_device_info["model"] = f"Generation {mill_device.generation}" - elif isinstance(mill_device, mill.Sensor): - self._attr_device_info["model"] = "Mill Sense Air" self._update_attr(mill_device) @callback diff --git a/requirements_all.txt b/requirements_all.txt index 965b0912d7a..645dcf3fde0 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1207,7 +1207,7 @@ micloud==0.5 mill-local==0.2.0 # homeassistant.components.mill -millheater==0.10.0 +millheater==0.11.0 # homeassistant.components.minio minio==7.1.12 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bf3054f9db0..c8e3c0e76e8 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -924,7 +924,7 @@ micloud==0.5 mill-local==0.2.0 # homeassistant.components.mill -millheater==0.10.0 +millheater==0.11.0 # homeassistant.components.minio minio==7.1.12