From ba659b88466c04c888103093f816487b3fd22b58 Mon Sep 17 00:00:00 2001 From: Dan Kelley Date: Thu, 25 Nov 2021 20:56:43 -0500 Subject: [PATCH] add a method to set aux heat cutover setting --- pyecobee/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pyecobee/__init__.py b/pyecobee/__init__.py index ebce5f1..925263b 100644 --- a/pyecobee/__init__.py +++ b/pyecobee/__init__.py @@ -675,6 +675,24 @@ def set_ventilator_timer(self, index: int, ventilator_on: bool) -> None: except (ExpiredTokenError, InvalidTokenError) as err: raise err + def set_aux_cutover_threshold(self, index: int, threshold: int) -> None: + """Set the threshold for outdoor temp below which alt heat will be used.""" + body = { + "selection": { + "selectionType": "thermostats", + "selectionMatch": self.thermostats[index]["identifier"], + }, + "thermostat": {"settings": {"compressorProtectionMinTemp": int(threshold * 10)}}, + } + log_msg_action = "set outdoor temp threshold for aux" + + try: + self._request_with_refresh( + "POST", ECOBEE_ENDPOINT_THERMOSTAT, log_msg_action, body=body + ) + except (ExpiredTokenError, InvalidTokenError) as err: + raise err + def _request_with_refresh( self, method: str,