Skip to content

Commit

Permalink
Fix hristo-atanasov#147 index error when swing_modes is empty (hristo…
Browse files Browse the repository at this point in the history
…-atanasov#148)

Fixed index error when fan_modes or swing_modes is empty
  • Loading branch information
nao-pon authored and PostLogical committed Jul 7, 2024
1 parent 2e6edde commit ded9c23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/tasmota_irhvac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,14 @@ def __init__(
new_fan_list.append(val)
self._attr_fan_modes = new_fan_list if len(new_fan_list) else None
self._attr_fan_mode = (
self._attr_fan_modes[0] if isinstance(self._attr_fan_modes, list) else None
self._attr_fan_modes[0]
if isinstance(self._attr_fan_modes, list) and len(self._attr_fan_modes)
else None
)
self._attr_swing_modes = config.get(CONF_SWING_LIST)
self._attr_swing_mode = (
self._attr_swing_modes[0]
if isinstance(self._attr_swing_modes, list)
if isinstance(self._attr_swing_modes, list) and len(self._attr_swing_modes)
else None
)
self._attr_preset_modes = (
Expand Down

0 comments on commit ded9c23

Please sign in to comment.