fix supportedFanOscillationModes is null (#105205)

* fix supportedFanOscillationModes is null

* set default supported_swings to None

* return None if no fan oscillation modes listed
This commit is contained in:
haimn 2023-12-07 19:03:07 +02:00 committed by GitHub
parent d86abf214b
commit 83a1ca5e83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -497,14 +497,16 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
"""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: