From a9f21982e7b70749697a06cf33786b5848320910 Mon Sep 17 00:00:00 2001 From: Pedro Date: Mon, 27 Jul 2026 09:57:31 -0300 Subject: [PATCH] Honour hvac_mode in the AC climate set_temperature HA's set_temperature service forwards an optional hvac_mode to the entity, and the entity is expected to apply it. The AC climate entity ignored it and only wrote the setpoint, so a set_temperature call carrying hvac_mode (e.g. a dashboard "turn on to Auto 24" button) set the temperature but never changed the mode or powered the unit on. Apply the mode first -- which powers the unit on when it was off -- then the setpoint. --- custom_components/localthings/climate.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/custom_components/localthings/climate.py b/custom_components/localthings/climate.py index 063b811..83ec75d 100644 --- a/custom_components/localthings/climate.py +++ b/custom_components/localthings/climate.py @@ -393,6 +393,16 @@ class LocalThingsClimate(LocalThingsEntity, ClimateEntity): return _HVAC_TO_DEVICE.get(hvac_mode) async def async_set_temperature(self, **kwargs) -> None: + # HA's set_temperature service forwards an optional hvac_mode here; honour + # it (set the mode first -- that also powers the unit on when it was off), + # matching the climate contract other integrations follow. Without this a + # set_temperature call carrying hvac_mode (e.g. a dashboard "turn on to + # Auto 24" button) set the setpoint but never changed mode or powered on. + hvac_mode = kwargs.get('hvac_mode') + if hvac_mode is not None: + await self.async_set_hvac_mode(hvac_mode) + if hvac_mode == HVACMode.OFF: + return temp = kwargs.get('temperature') if temp is None: return