From 4c766bf1625a57d6cd3387772d71d3fc579499f9 Mon Sep 17 00:00:00 2001 From: Alex X Date: Tue, 15 Oct 2024 20:57:13 +0300 Subject: [PATCH] Turn on HVAC before changing mode #366 --- custom_components/yandex_station/climate.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/custom_components/yandex_station/climate.py b/custom_components/yandex_station/climate.py index 1b006ee..5bbcd5d 100644 --- a/custom_components/yandex_station/climate.py +++ b/custom_components/yandex_station/climate.py @@ -152,18 +152,16 @@ def on_track_humidity(self, value): async def async_set_hvac_mode(self, hvac_mode: HVACMode): if hvac_mode == HVACMode.OFF: - kwargs = {"on": False} + await self.quasar.device_action(self.device, "on", False) elif self.hvac_instance is None: - kwargs = {"on": True} + await self.quasar.device_action(self.device, "on", True) else: - kwargs = ( - {"on": True, self.hvac_instance: str(hvac_mode)} - if self._attr_hvac_mode == HVACMode.OFF - else {self.hvac_instance: str(hvac_mode)} + if self._attr_hvac_mode == HVACMode.OFF: + await self.quasar.device_action(self.device, "on", True) + await self.quasar.device_action( + self.device, self.hvac_instance, str(hvac_mode) ) - await self.quasar.device_actions(self.device, **kwargs) - async def async_set_temperature(self, temperature: float, **kwargs): await self.quasar.device_action(self.device, "temperature", temperature)