From b79ebdcc2fd4ef0512e69d1324b3d5dba01cba9a Mon Sep 17 00:00:00 2001 From: Shaun Tarves Date: Wed, 28 Apr 2021 09:21:56 -0400 Subject: [PATCH] Fixed issue with thermostat parsing [Closes #6] --- wyze_sdk/models/devices/thermostats.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wyze_sdk/models/devices/thermostats.py b/wyze_sdk/models/devices/thermostats.py index 3ec28bb..1ccd952 100644 --- a/wyze_sdk/models/devices/thermostats.py +++ b/wyze_sdk/models/devices/thermostats.py @@ -219,6 +219,8 @@ def fan_mode(self) -> ThermostatFanMode: @fan_mode.setter def fan_mode(self, value: Union[str, DeviceProp]): + if value is None: + return if isinstance(value, str): value = DeviceProp(definition=ThermostatProps.fan_mode, value=value) self._fan_mode = ThermostatFanMode.parse(value.value) @@ -229,6 +231,8 @@ def system_mode(self) -> ThermostatSystemMode: @system_mode.setter def system_mode(self, value: Union[str, DeviceProp]): + if value is None: + return if isinstance(value, str): value = DeviceProp(definition=ThermostatProps.system_mode, value=value) self._system_mode = ThermostatSystemMode.parse(value.value) @@ -239,6 +243,8 @@ def current_scenario(self) -> ThermostatScenarioType: @current_scenario.setter def current_scenario(self, value: Union[str, DeviceProp]): + if value is None: + return if isinstance(value, str): value = DeviceProp(definition=ThermostatProps.current_scenario, value=value) self._current_scenario = ThermostatScenarioType.parse(value.value)