Skip to content

Commit

Permalink
fix supportedFanOscillationModes is null (#105205)
Browse files Browse the repository at this point in the history
* fix supportedFanOscillationModes is null

* set default supported_swings to None

* return None if no fan oscillation modes listed
  • Loading branch information
haimn authored Dec 7, 2023
1 parent d86abf2 commit 83a1ca5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions homeassistant/components/smartthings/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,16 @@ def temperature_unit(self) -> str:
"""Return the unit of measurement."""
return UNIT_MAP[self._device.status.attributes[Attribute.temperature].unit]

def _determine_swing_modes(self) -> list[str]:
def _determine_swing_modes(self) -> list[str] | None:
"""Return the list of available swing modes."""
supported_swings = None
supported_modes = self._device.status.attributes[
Attribute.supported_fan_oscillation_modes
][0]
supported_swings = [
FAN_OSCILLATION_TO_SWING.get(m, SWING_OFF) for m in supported_modes
]
if supported_modes is not None:
supported_swings = [
FAN_OSCILLATION_TO_SWING.get(m, SWING_OFF) for m in supported_modes
]
return supported_swings

async def async_set_swing_mode(self, swing_mode: str) -> None:
Expand Down

0 comments on commit 83a1ca5

Please sign in to comment.