From fcc69115c75f3bad9b5c6395a534ad2883664dbb Mon Sep 17 00:00:00 2001 From: xZetsubou Date: Thu, 16 May 2024 07:07:20 +0300 Subject: [PATCH] Set dp_id True only if the device is off. #235 * This is an attempt to fix a device that sometiems refuse to change HVAC instantly --- custom_components/localtuya/climate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/localtuya/climate.py b/custom_components/localtuya/climate.py index 184bbb8f2..9d16d0bec 100644 --- a/custom_components/localtuya/climate.py +++ b/custom_components/localtuya/climate.py @@ -427,7 +427,9 @@ async def async_set_fan_mode(self, fan_mode): async def async_set_hvac_mode(self, hvac_mode): """Set new target operation mode.""" - new_states = {self._dp_id: hvac_mode != HVACMode.OFF} + new_states = {} + if not self._state: + new_states[self._dp_id] = True if hvac_mode in self._hvac_mode_set: new_states[self._hvac_mode_dp] = self._hvac_mode_set[hvac_mode]