Skip to content

Commit

Permalink
Tweak for "ELECTRA_AC" protocol set_fan_mode
Browse files Browse the repository at this point in the history
Some "ELECTRA_AC" devices has their fan modes (speed) for "high" and "max" options named wrong as "max" and "auto".
  • Loading branch information
hristo-atanasov authored Dec 17, 2021
1 parent a2630ad commit 3f50723
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def fan_modes(self):
Requires SUPPORT_FAN_MODE.
"""
# tweek for some ELECTRA_AC devices
# tweak for some ELECTRA_AC devices
if HVAC_FAN_MAX_HIGH in self._fan_list and HVAC_FAN_AUTO_MAX in self._fan_list:
new_fan_list = []
for val in self._fan_list:
Expand Down Expand Up @@ -838,11 +838,20 @@ async def async_set_temperature(self, **kwargs):
async def async_set_fan_mode(self, fan_mode):
"""Set new target fan mode."""
if fan_mode not in self._fan_list:
_LOGGER.error(
"Invalid swing mode selected. Got '%s'. Allowed modes are:", fan_mode
)
_LOGGER.error(self._fan_list)
return
#tweak for some ELECTRA_AC devices
if HVAC_FAN_MAX_HIGH in self._fan_list and HVAC_FAN_AUTO_MAX in self._fan_list:
if fan_mode != FAN_HIGH and fan_mode != HVAC_FAN_MAX:
_LOGGER.error(
"Invalid swing mode selected. Got '%s'. Allowed modes are:", fan_mode
)
_LOGGER.error(self._fan_list)
return
else:
_LOGGER.error(
"Invalid swing mode selected. Got '%s'. Allowed modes are:", fan_mode
)
_LOGGER.error(self._fan_list)
return
self._fan_mode = fan_mode
if not self._hvac_mode.lower() == HVAC_MODE_OFF:
self.power_mode = STATE_ON
Expand Down

0 comments on commit 3f50723

Please sign in to comment.