Skip to content

Commit

Permalink
Merge pull request #17 from shauntarves/15-api-updates-state-but-actu…
Browse files Browse the repository at this point in the history
…al-thermostat-unit-does-not

Converted several thermostat calls to use
  • Loading branch information
shauntarves authored May 11, 2021
2 parents 6286cff + 27caf32 commit 873c204
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions wyze_sdk/api/devices/thermostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def set_system_mode(self, *, device_mac: str, device_model: str, system_mode: Th
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["system_mode"], value=system_mode.codes))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["system_mode"], value=system_mode.codes))

def set_fan_mode(self, *, device_mac: str, device_model: str, fan_mode: ThermostatFanMode, **kwargs) -> WyzeResponse:
"""Sets the fan mode of the thermostat.
Expand All @@ -67,7 +67,7 @@ def set_fan_mode(self, *, device_mac: str, device_model: str, fan_mode: Thermost
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["fan_mode"], value=fan_mode.codes))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["fan_mode"], value=fan_mode.codes))

def set_mode(self, *, device_mac: str, device_model: str, system_mode: ThermostatSystemMode, fan_mode: ThermostatFanMode, **kwargs) -> WyzeResponse:
"""Sets the system and fan modes of the thermostat.
Expand Down Expand Up @@ -106,7 +106,7 @@ def set_heating_setpoint(self, *, device_mac: str, device_model: str, heating_se
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["heating_setpoint"], value=heating_setpoint))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["heating_setpoint"], value=heating_setpoint))

def set_cooling_setpoint(self, *, device_mac: str, device_model: str, cooling_setpoint: int, **kwargs) -> WyzeResponse:
"""Sets the cooling setpoint of the thermostat.
Expand All @@ -117,7 +117,7 @@ def set_cooling_setpoint(self, *, device_mac: str, device_model: str, cooling_se
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["cooling_setpoint"], value=cooling_setpoint))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["cooling_setpoint"], value=cooling_setpoint))

def set_temperature(self, *, device_mac: str, device_model: str, cooling_setpoint: int, heating_setpoint: int, **kwargs) -> WyzeResponse:
"""Sets the heating and cooling setpoints of the thermostat.
Expand Down Expand Up @@ -187,7 +187,7 @@ def set_lock(self, *, device_mac: str, device_model: str, locked: int, **kwargs)
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["locked"], value=locked))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["locked"], value=locked))

def set_behavior(self, *, device_mac: str, device_model: str, behavior: int, **kwargs) -> WyzeResponse:
"""Sets the comfort balance behavior for a thermostat.
Expand All @@ -201,4 +201,4 @@ def set_behavior(self, *, device_mac: str, device_model: str, behavior: int, **k
:rtype: WyzeResponse
"""
return self._set_thermostat_property(device_mac, device_model, DeviceProp(definition=Thermostat.props()["save_comfort_balance"], value=behavior))
return self._set_thermostat_properties(device_mac, device_model, DeviceProp(definition=Thermostat.props()["save_comfort_balance"], value=behavior))
2 changes: 2 additions & 0 deletions wyze_sdk/service/earth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def get_iot_prop(self, *, did: str, keys: Union[str, Sequence[str]], **kwargs) -
return self.api_call('/plugin/earth/get_iot_prop', http_verb="GET", params=kwargs)

def set_iot_prop(self, *, did: str, model: str, key: str, value: str, is_sub_device: bool = False, **kwargs) -> WyzeResponse:
# This method is only used for updating the schedule and the resetting the filter(s) - basically
# anything that doesn't need to talk to the physical unit
kwargs.update({
'did': did,
'model': model,
Expand Down

0 comments on commit 873c204

Please sign in to comment.