1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-20 02:48:57 +00:00

Mill: Add ability to set heating device to AUTO (#157745)

This commit is contained in:
Richard
2025-12-18 19:00:30 +01:00
committed by GitHub
parent 78cc41fdc0
commit ef28715360

View File

@@ -160,7 +160,7 @@ class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntit
"""Representation of a Mill Thermostat device.""" """Representation of a Mill Thermostat device."""
_attr_has_entity_name = True _attr_has_entity_name = True
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] _attr_hvac_modes = [HVACMode.HEAT, HVACMode.AUTO, HVACMode.OFF]
_attr_max_temp = MAX_TEMP _attr_max_temp = MAX_TEMP
_attr_min_temp = MIN_TEMP _attr_min_temp = MIN_TEMP
_attr_name = None _attr_name = None
@@ -205,6 +205,9 @@ class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntit
elif hvac_mode == HVACMode.OFF: elif hvac_mode == HVACMode.OFF:
await self.coordinator.mill_data_connection.set_operation_mode_off() await self.coordinator.mill_data_connection.set_operation_mode_off()
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
elif hvac_mode == HVACMode.AUTO:
await self.coordinator.mill_data_connection.set_operation_mode_weekly_program()
await self.coordinator.async_request_refresh()
@callback @callback
def _handle_coordinator_update(self) -> None: def _handle_coordinator_update(self) -> None:
@@ -218,12 +221,19 @@ class LocalMillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntit
self._attr_target_temperature = data["set_temperature"] self._attr_target_temperature = data["set_temperature"]
self._attr_current_temperature = data["ambient_temperature"] self._attr_current_temperature = data["ambient_temperature"]
if data["operation_mode"] == OperationMode.OFF.value: operation_mode = data["operation_mode"]
is_heating = data["current_power"] > 0
if operation_mode == OperationMode.OFF.value:
self._attr_hvac_mode = HVACMode.OFF self._attr_hvac_mode = HVACMode.OFF
self._attr_hvac_action = HVACAction.OFF self._attr_hvac_action = HVACAction.OFF
elif operation_mode == OperationMode.WEEKLY_PROGRAM.value:
self._attr_hvac_mode = HVACMode.AUTO
self._attr_hvac_action = (
HVACAction.HEATING if is_heating else HVACAction.IDLE
)
else: else:
self._attr_hvac_mode = HVACMode.HEAT self._attr_hvac_mode = HVACMode.HEAT
if data["current_power"] > 0: self._attr_hvac_action = (
self._attr_hvac_action = HVACAction.HEATING HVACAction.HEATING if is_heating else HVACAction.IDLE
else: )
self._attr_hvac_action = HVACAction.IDLE