Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions PyTado/interface/api/hops_tado.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
18 changes: 18 additions & 0 deletions tests/test_hops_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading