Skip to content

Commit

Permalink
Fix non-initialized _swing_modes introduced in #222 (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 committed Sep 4, 2024
1 parent 6584607 commit b10d095
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions custom_components/midea_ac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,13 @@ def __init__(self,
self._fan_modes = [m.name.lower()
for m in self._device.supported_fan_speeds]

# Fetch supported swing modes
if (swing_modes := self._device.supported_swing_modes) != [AC.SwingMode.OFF]:
# Add swing modes to supported features
# If device supports any swing mode, add it to supported features
if self._device.supported_swing_modes != [AC.SwingMode.OFF]:
self._supported_features |= ClimateEntityFeature.SWING_MODE

# Convert Midea swing modes to strings
self._swing_modes = [m.name.lower()
for m in swing_modes]
# Convert Midea swing modes to strings
self._swing_modes = [m.name.lower()
for m in self._device.supported_swing_modes]

# Dump all supported modes for debug
_LOGGER.debug("Supported operational modes: '%s'.",
Expand Down

0 comments on commit b10d095

Please sign in to comment.