From 345656f59106a462650abd52f205f24ccd546591 Mon Sep 17 00:00:00 2001 From: Filippo Barba Date: Fri, 3 Jan 2025 21:40:31 +0100 Subject: [PATCH 1/2] fix: remove decorator --- PyTado/interface/api/hops_tado.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PyTado/interface/api/hops_tado.py b/PyTado/interface/api/hops_tado.py index a058114..6b3177b 100644 --- a/PyTado/interface/api/hops_tado.py +++ b/PyTado/interface/api/hops_tado.py @@ -284,7 +284,6 @@ def get_open_window_detected(self, zone): else: return {"openWindowDetected": False} - @not_supported("This method is not currently supported by the Tado X API") def set_open_window(self, zone): """ Sets the window in zone to open From 5fecd15ca9dc28a18c8cab49434d421f52c6c597 Mon Sep 17 00:00:00 2001 From: Filippo Barba Date: Fri, 3 Jan 2025 21:54:12 +0100 Subject: [PATCH 2/2] fix: remove old reference + tests --- PyTado/interface/api/hops_tado.py | 4 ++-- tests/test_hops_zone.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/PyTado/interface/api/hops_tado.py b/PyTado/interface/api/hops_tado.py index 6b3177b..75733f5 100644 --- a/PyTado/interface/api/hops_tado.py +++ b/PyTado/interface/api/hops_tado.py @@ -289,7 +289,7 @@ def set_open_window(self, zone): Sets the window in zone to open Note: This can only be set if an open window was detected in this zone """ - request = self._create_x_request() + request = TadoXRequest() request.command = f"rooms/{zone}/openWindow" request.action = Action.SET @@ -299,7 +299,7 @@ def reset_open_window(self, zone): """ Sets the window in zone to closed """ - request = self._create_x_request() + request = TadoXRequest() request.command = f"rooms/{zone}/openWindow" request.action = Action.RESET diff --git a/tests/test_hops_zone.py b/tests/test_hops_zone.py index acfb0f9..bfd8a19 100644 --- a/tests/test_hops_zone.py +++ b/tests/test_hops_zone.py @@ -167,3 +167,21 @@ def test_get_devices(self): room_1 = rooms[0] assert room_1['roomName'] == 'Room 1' assert room_1['devices'][0]['serialNumber'] == 'VA1234567890' + + def test_set_window_open(self): + """ Test get_devices method """ + self.set_get_devices_fixture("tadox/rooms_and_devices.json") + + devices_and_rooms = self.tado_client.get_devices() + for room in devices_and_rooms['rooms']: + result = self.tado_client.set_open_window(zone=room) + assert isinstance(result, dict) + + def test_reset_window_open(self): + """ Test get_devices method """ + self.set_get_devices_fixture("tadox/rooms_and_devices.json") + + devices_and_rooms = self.tado_client.get_devices() + for room in devices_and_rooms['rooms']: + result = self.tado_client.reset_open_window(zone=room) + assert isinstance(result, dict)