-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add room support for accessories attached to thermostat (#58)
* add support for priority and rooms * Update deploy.yml * Update deploy.yml * bit of clean up * get ready for PR
- Loading branch information
Showing
5 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
""" | ||
Class object for LyricPriority | ||
Documentation: https://github.com/timmo001/aiolyric | ||
Generated by generator/generator.py - 2023-07-27 18:30:29.139453 | ||
""" | ||
from .base import LyricBase | ||
|
||
|
||
class LyricAccessories(LyricBase): | ||
|
||
@property | ||
def id(self): | ||
return self.attributes.get("id", None) | ||
|
||
@property | ||
def type(self): | ||
return self.attributes.get("type", "") | ||
|
||
@property | ||
def excludeTemp(self): | ||
return self.attributes.get("excludeTemp", False) | ||
|
||
@property | ||
def excludeMotion(self): | ||
return self.attributes.get("excludeMotion", False) | ||
|
||
@property | ||
def temperature(self): | ||
return self.attributes.get("temperature", None) | ||
|
||
@property | ||
def status(self): | ||
return self.attributes.get("status", "") | ||
|
||
@property | ||
def detectMotion(self): | ||
return self.attributes.get("detectMotion", False) | ||
|
||
|
||
class LyricRoom(LyricBase): | ||
|
||
@property | ||
def id(self): | ||
return self.attributes.get("id", None) | ||
|
||
@property | ||
def roomName(self): | ||
return self.attributes.get("roomName", "") | ||
|
||
@property | ||
def roomAvgTemp(self): | ||
return self.attributes.get("roomAvgTemp", None) | ||
|
||
@property | ||
def roomAvgHumidity(self): | ||
return self.attributes.get("roomAvgHumidity", None) | ||
|
||
@property | ||
def overallMotion(self): | ||
return self.attributes.get("overallMotion", False) | ||
|
||
@property | ||
def accessories(self): | ||
return [LyricAccessories(x) for x in self.attributes.get("accessories", [])] | ||
|
||
|
||
class CurrentPriority(LyricBase): | ||
|
||
@property | ||
def priorityType(self): | ||
return self.attributes.get("priorityType", "") | ||
|
||
@property | ||
def selectedRooms(self): | ||
return self.attributes.get("selectedRooms", []) | ||
|
||
@property | ||
def rooms(self): | ||
return [LyricRoom(x) for x in self.attributes.get("rooms", [])] | ||
|
||
|
||
class LyricPriority(LyricBase): | ||
|
||
@property | ||
def deviceId(self): | ||
return self.attributes.get("deviceId", "") | ||
|
||
@property | ||
def status(self): | ||
return self.attributes.get("status", "") | ||
|
||
@property | ||
def currentPriority(self): | ||
return CurrentPriority(self.attributes.get("currentPriority", {})) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
Generated by generator/generator.py - 2023-07-27 18:30:29.139453 | ||
""" | ||
from aiolyric.objects.priority import LyricPriority | ||
from tests.responses.priority_fixture import priority_fixture_response | ||
|
||
def test_priority(priority_fixture_response): | ||
obj = LyricPriority(priority_fixture_response) | ||
assert obj.deviceId == priority_fixture_response['deviceId'] | ||
assert obj.status == priority_fixture_response['status'] | ||
assert obj.currentPriority.priorityType == priority_fixture_response['currentPriority']['priorityType'] | ||
assert obj.currentPriority.selectedRooms[0] == priority_fixture_response['currentPriority']['selectedRooms'][0] | ||
assert obj.currentPriority.rooms[0].id == priority_fixture_response['currentPriority']['rooms'][0]['id'] | ||
assert obj.currentPriority.rooms[0].roomName == priority_fixture_response['currentPriority']['rooms'][0]['roomName'] | ||
assert obj.currentPriority.rooms[0].roomAvgTemp == priority_fixture_response['currentPriority']['rooms'][0]['roomAvgTemp'] | ||
assert obj.currentPriority.rooms[0].roomAvgHumidity == priority_fixture_response['currentPriority']['rooms'][0]['roomAvgHumidity'] | ||
assert obj.currentPriority.rooms[0].overallMotion == priority_fixture_response['currentPriority']['rooms'][0]['overallMotion'] | ||
assert obj.currentPriority.rooms[0].accessories == priority_fixture_response['currentPriority']['rooms'][0]['accessories'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
Generated by generator/generator.py - 2023-07-27 18:30:29.139453 | ||
""" | ||
import pytest | ||
|
||
|
||
@pytest.fixture() | ||
def priority_fixture_response(): | ||
return { | ||
'deviceId': '00A01AB1ABCD', | ||
'status': 'NoHold', | ||
'currentPriority': { | ||
'priorityType': 'PickARoom', | ||
'selectedRooms': [ | ||
0 | ||
], | ||
'rooms': [ | ||
{ | ||
'id': 0, | ||
'roomName': 'Hallway', | ||
'roomAvgTemp': 76, | ||
'roomAvgHumidity': 54, | ||
'overallMotion': False, | ||
'accessories': [ | ||
{ | ||
'id': 0, | ||
'type': 'Thermostat', | ||
'excludeTemp': False, | ||
'excludeMotion': False, | ||
'temperature': 75.828, | ||
'status': 'Ok', | ||
'detectMotion': False | ||
} | ||
] | ||
}, | ||
{ | ||
'id': 1, | ||
'roomName': 'Office', | ||
'roomAvgTemp': 76, | ||
'roomAvgHumidity': 52, | ||
'overallMotion': True, | ||
'accessories': [ | ||
{ | ||
'id': 1, | ||
'type': 'IndoorAirSensor', | ||
'excludeTemp': False, | ||
'excludeMotion': False, | ||
'temperature': 76, | ||
'status': 'Ok', | ||
'detectMotion': True | ||
} | ||
] | ||
}, | ||
{ | ||
'id': 2, | ||
'roomName': 'Master Bedroom', | ||
'roomAvgTemp': 76, | ||
'roomAvgHumidity': 52, | ||
'overallMotion': False, | ||
'accessories': [ | ||
{ | ||
'id': 2, | ||
'type': 'IndoorAirSensor', | ||
'excludeTemp': False, | ||
'excludeMotion': False, | ||
'temperature': 76, | ||
'status': 'Ok', | ||
'detectMotion': True | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |