diff --git a/PyTado/interface/api/hops_tado.py b/PyTado/interface/api/hops_tado.py index a058114..75733f5 100644 --- a/PyTado/interface/api/hops_tado.py +++ b/PyTado/interface/api/hops_tado.py @@ -284,13 +284,12 @@ 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 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 @@ -300,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)