3030 FAN_AUTO ,
3131 FAN_DIFFUSE ,
3232 FAN_FOCUS ,
33+ FAN_TOP ,
3334 FAN_HIGH ,
3435 FAN_LOW ,
3536 FAN_MEDIUM ,
230231 FAN_MIDDLE ,
231232 FAN_FOCUS ,
232233 FAN_DIFFUSE ,
234+ FAN_TOP ,
233235 HVAC_FAN_MIN ,
234236 HVAC_FAN_MEDIUM ,
235237 HVAC_FAN_MAX ,
@@ -547,12 +549,14 @@ def __init__(
547549 self ._attr_hvac_mode = config .get (CONF_INITIAL_OPERATION_MODE )
548550 self ._attr_target_temperature_step = config [CONF_TEMP_STEP ]
549551 self ._attr_hvac_modes = config [CONF_MODES_LIST ]
552+ self .use_electra_tweak = False
550553 self ._attr_fan_modes = config .get (CONF_FAN_LIST )
551554 if (
552555 isinstance (self ._attr_fan_modes , list )
553556 and HVAC_FAN_MAX_HIGH in self ._attr_fan_modes
554557 and HVAC_FAN_AUTO_MAX in self ._attr_fan_modes
555558 ):
559+ self .use_electra_tweak = True
556560 new_fan_list = []
557561 for val in self ._attr_fan_modes :
558562 if val == HVAC_FAN_MAX_HIGH :
@@ -797,13 +801,13 @@ async def state_message_received(message: mqtt.ReceiveMessage) -> None:
797801 if "FanSpeed" in payload :
798802 fan_mode = payload ["FanSpeed" ].lower ()
799803 # ELECTRA_AC fan modes fix
800- if HVAC_FAN_MAX_HIGH in (
801- self ._attr_fan_modes or []
802- ) and HVAC_FAN_AUTO_MAX in (self ._attr_fan_modes or []):
804+ if self .use_electra_tweak :
803805 if fan_mode == HVAC_FAN_MAX :
804806 self ._attr_fan_mode = FAN_HIGH
805807 elif fan_mode == HVAC_FAN_AUTO :
806808 self ._attr_fan_mode = HVAC_FAN_MAX
809+ elif fan_mode == HVAC_FAN_MIN :
810+ self ._attr_fan_mode = FAN_LOW
807811 else :
808812 self ._attr_fan_mode = fan_mode
809813 else :
@@ -943,9 +947,7 @@ async def async_set_fan_mode(self, fan_mode):
943947 """Set new target fan mode."""
944948 if fan_mode not in (self ._attr_fan_modes or []):
945949 # tweak for some ELECTRA_AC devices
946- if HVAC_FAN_MAX_HIGH in (
947- self ._attr_fan_modes or []
948- ) and HVAC_FAN_AUTO_MAX in (self ._attr_fan_modes or []):
950+ if self .use_electra_tweak :
949951 if fan_mode != FAN_HIGH and fan_mode != HVAC_FAN_MAX :
950952 _LOGGER .error (
951953 "Invalid swing mode selected. Got '%s'. Allowed modes are:" ,
@@ -960,6 +962,7 @@ async def async_set_fan_mode(self, fan_mode):
960962 )
961963 _LOGGER .error (self ._attr_fan_modes )
962964 return
965+
963966 self ._attr_fan_mode = fan_mode
964967 if not self ._attr_hvac_mode == HVACMode .OFF :
965968 self .power_mode = STATE_ON
@@ -1210,14 +1213,15 @@ async def set_mode(self, hvac_mode):
12101213 async def send_ir (self ):
12111214 """Send the payload to tasmota mqtt topic."""
12121215 fan_speed = self .fan_mode
1216+
12131217 # tweak for some ELECTRA_AC devices
1214- if HVAC_FAN_MAX_HIGH in (self ._attr_fan_modes or []) and HVAC_FAN_AUTO_MAX in (
1215- self ._attr_fan_modes or []
1216- ):
1218+ if self .use_electra_tweak :
12171219 if self .fan_mode == FAN_HIGH :
12181220 fan_speed = HVAC_FAN_MAX
12191221 if self .fan_mode == HVAC_FAN_MAX :
12201222 fan_speed = HVAC_FAN_AUTO
1223+ if self .fan_mode == FAN_LOW :
1224+ fan_speed = HVAC_FAN_MIN
12211225
12221226 # Set the swing mode - default off
12231227 self ._swingv = STATE_OFF if self ._fix_swingv is None else self ._fix_swingv
0 commit comments