Skip to content

Commit

Permalink
fix preste state null always when it conflicts with hvac modes
Browse files Browse the repository at this point in the history
- Ensure the preset dp is the same hvac mode dp before check.

- The condition would ensure that if preset and hvac share same dp to not update preset mode if hvac changed. this made because if preset contains more hvac modes that aren't supported by HA would give user ability to change it otherwise state would be stuck to the latest one and would reqiure to change it to another one then back.
  • Loading branch information
xZetsubou committed Jan 17, 2025
1 parent caa418c commit 4d52231
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/localtuya/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ def hvac_action(self):
def preset_mode(self):
"""Return current preset."""
mode = self.dp_value(CONF_HVAC_MODE_DP)
if mode in list(self._hvac_mode_set.values()):
if self._preset_dp == self._hvac_mode_dp and (
mode in list(self._hvac_mode_set.values())
):
return None

return self._preset_mode
Expand Down

0 comments on commit 4d52231

Please sign in to comment.