diff --git a/PyTado/http.py b/PyTado/http.py index 2c883fb..8d325cf 100644 --- a/PyTado/http.py +++ b/PyTado/http.py @@ -282,7 +282,7 @@ def _refresh_token(self) -> None: f"Unknown error while refreshing token with status code {response.status_code}" ) - def _login(self) -> tuple[int, bool, str] | None: + def _login(self) -> tuple[int, str] | None: headers = self._headers headers["Content-Type"] = "application/json" diff --git a/PyTado/interface/api/hops_tado.py b/PyTado/interface/api/hops_tado.py index d67f9e9..d21c174 100644 --- a/PyTado/interface/api/hops_tado.py +++ b/PyTado/interface/api/hops_tado.py @@ -56,7 +56,7 @@ def __init__( # set to None until explicitly set self._auto_geofencing_supported = None - def _create_request(self) -> TadoRequest: + def _create_x_request(self) -> TadoRequest: return TadoXRequest() def get_devices(self): @@ -64,7 +64,7 @@ def get_devices(self): Gets device information. """ - request = self._create_request() + request = self._create_x_request() request.command = "roomsAndDevices" rooms: list[dict[str, Any]] = self._http.request(request)["rooms"] @@ -77,7 +77,7 @@ def get_zones(self): Gets zones information. """ - request = self._create_request() + request = self._create_x_request() request.command = "roomsAndDevices" return self._http.request(request)["rooms"] @@ -94,7 +94,7 @@ def get_zone_states(self): Gets current states of all zones. """ - request = self._create_request() + request = self._create_x_request() request.command = "rooms" return self._http.request(request) @@ -104,7 +104,7 @@ def get_state(self, zone): Gets current state of Zone. """ - request = self._create_request() + request = self._create_x_request() request.command = f"rooms/{zone:d}" data = self._http.request(request) @@ -150,7 +150,7 @@ def get_schedule( Zone has 3 different schedules, one for each timetable (see setTimetable) """ - request = self._create_request() + request = self._create_x_request() request.command = f"rooms/{zone:d}/schedule" return self._http.request(request) @@ -160,7 +160,7 @@ def set_schedule(self, zone, timetable: Timetable, day, data): Set the schedule for a zone, day is required """ - request = self._create_request() + request = self._create_x_request() request.command = f"rooms/{zone:d}/schedule" request.action = Action.SET request.payload = data @@ -173,7 +173,7 @@ def reset_zone_overlay(self, zone): Delete current overlay """ - request = self._create_request() + request = self._create_x_request() request.command = f"rooms/{zone:d}/resumeSchedule" request.action = Action.SET @@ -213,7 +213,7 @@ def set_zone_overlay( if duration is not None: post_data["termination"]["durationInSeconds"] = duration - request = self._create_request() + request = self._create_x_request() request.command = f"rooms/{zone:d}/manualControl" request.action = Action.SET request.payload = post_data @@ -236,7 +236,7 @@ def get_open_window_detected(self, zone): data = self.get_state(zone) - if "activated" in data["openWindow"]: + if data["openWindow"] and "activated" in data["openWindow"]: return {"openWindowDetected": True} else: return {"openWindowDetected": False} @@ -275,7 +275,7 @@ def set_temp_offset(self, device_id, offset=0, measure="celsius"): Set the Temperature offset on the device. """ - request = self._create_request() + request = self._create_x_request() request.command = f"roomsAndDevices/devices/{device_id}" request.action = Action.CHANGE request.payload = {"temperatureOffset": offset} diff --git a/pyproject.toml b/pyproject.toml index bed8071..f15073d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,12 @@ build-backend = "setuptools.build_meta" [project] name = "python-tado" -version = "0.18.2" +version = "0.18.3" description = "PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem" authors = [ { name = "Chris Jewell", email = "chrism0dwk@gmail.com" }, { name = "w.malgadey", email = "w.malgadey@gmail.com" }, + { name = "FilBr", email = "filippo.barba@protonmail.com" }, ] dependencies = ["requests"] requires-python = ">=3.11"