From d497dd98218a06fb9a86251c26331696482b73c5 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Thu, 21 Nov 2024 09:41:21 +0000 Subject: [PATCH] ci: Generate code --- seam/routes/models.py | 14 +++++++++++++ seam/routes/thermostats.py | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/seam/routes/models.py b/seam/routes/models.py index 1b31c30..b64fdb8 100644 --- a/seam/routes/models.py +++ b/seam/routes/models.py @@ -1981,6 +1981,20 @@ def set_fan_mode( ) -> ActionAttempt: raise NotImplementedError() + @abc.abstractmethod + def set_hvac_mode( + self, + *, + device_id: str, + hvac_mode_setting: str, + cooling_set_point_celsius: Optional[float] = None, + cooling_set_point_fahrenheit: Optional[float] = None, + heating_set_point_celsius: Optional[float] = None, + heating_set_point_fahrenheit: Optional[float] = None, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + raise NotImplementedError() + @abc.abstractmethod def set_temperature_threshold( self, diff --git a/seam/routes/thermostats.py b/seam/routes/thermostats.py index 14a937b..47e593e 100644 --- a/seam/routes/thermostats.py +++ b/seam/routes/thermostats.py @@ -346,6 +346,46 @@ def set_fan_mode( wait_for_action_attempt=wait_for_action_attempt, ) + def set_hvac_mode( + self, + *, + device_id: str, + hvac_mode_setting: str, + cooling_set_point_celsius: Optional[float] = None, + cooling_set_point_fahrenheit: Optional[float] = None, + heating_set_point_celsius: Optional[float] = None, + heating_set_point_fahrenheit: Optional[float] = None, + wait_for_action_attempt: Optional[Union[bool, Dict[str, float]]] = None + ) -> ActionAttempt: + json_payload = {} + + if device_id is not None: + json_payload["device_id"] = device_id + if hvac_mode_setting is not None: + json_payload["hvac_mode_setting"] = hvac_mode_setting + if cooling_set_point_celsius is not None: + json_payload["cooling_set_point_celsius"] = cooling_set_point_celsius + if cooling_set_point_fahrenheit is not None: + json_payload["cooling_set_point_fahrenheit"] = cooling_set_point_fahrenheit + if heating_set_point_celsius is not None: + json_payload["heating_set_point_celsius"] = heating_set_point_celsius + if heating_set_point_fahrenheit is not None: + json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit + + res = self.client.post("/thermostats/set_hvac_mode", json=json_payload) + + wait_for_action_attempt = ( + self.defaults.get("wait_for_action_attempt") + if wait_for_action_attempt is None + else wait_for_action_attempt + ) + + return resolve_action_attempt( + client=self.client, + action_attempt=ActionAttempt.from_dict(res["action_attempt"]), + wait_for_action_attempt=wait_for_action_attempt, + ) + def set_temperature_threshold( self, *,