Skip to content
Open
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
14 changes: 7 additions & 7 deletions aiolyric/objects/priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def id(self):
@property
def type(self):
"""Get the type of the accessory."""
return self.attributes.get("type", "")
return self.attributes.get("sensorType", "")

@property
def exclude_temp(self):
"""Check if temperature is excluded for the accessory."""
return self.attributes.get("excludeTemp", False)
return self.attributes.get("excludeTemperature", False)

@property
def exclude_motion(self):
Expand Down Expand Up @@ -53,17 +53,17 @@ def id(self):
@property
def room_name(self):
"""Get the name of the room."""
return self.attributes.get("roomName", "")
return self.attributes.get("name", "")

@property
def room_avg_temp(self):
"""Get the average temperature of the room."""
return self.attributes.get("roomAvgTemp", None)
return self.attributes.get("avgTemperature", None)

@property
def room_avg_humidity(self):
"""Get the average humidity of the room."""
return self.attributes.get("roomAvgHumidity", None)
return self.attributes.get("avgHumidity", None)

@property
def overall_motion(self):
Expand Down Expand Up @@ -106,9 +106,9 @@ def device_id(self):
@property
def status(self):
"""Get the status of the priority."""
return self.attributes.get("status", "")
return self.attributes.get("priorityStatus", "")

@property
def current_priority(self):
"""Get the current priority."""
return CurrentPriority(self.attributes.get("currentPriority", {}))
return CurrentPriority(self.attributes.get("priority", {}))
34 changes: 17 additions & 17 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,22 @@

RESPONSE_JSON_PRIORITY: Final[dict] = {
"deviceId": "00A01AB1ABCD",
"status": "NoHold",
"currentPriority": {
"priorityStatus": "NoHold",
"priority": {
"priorityType": "PickARoom",
"selectedRooms": [0],
"rooms": [
{
"id": 0,
"roomName": "Hallway",
"roomAvgTemp": 76,
"roomAvgHumidity": 54,
"name": "Hallway",
"avgTemperature": 76,
"avgHumidity": 54,
"overallMotion": False,
"accessories": [
{
"id": 0,
"type": "Thermostat",
"excludeTemp": False,
"sensorType": "Thermostat",
"excludeTemperature": False,
"excludeMotion": False,
"temperature": 75.828,
"status": "Ok",
Expand All @@ -211,15 +211,15 @@
},
{
"id": 1,
"roomName": "Office",
"roomAvgTemp": 76,
"roomAvgHumidity": 52,
"name": "Office",
"avgTemperature": 76,
"avgHumidity": 52,
"overallMotion": True,
"accessories": [
{
"id": 1,
"type": "IndoorAirSensor",
"excludeTemp": False,
"sensorType": "IndoorAirSensor",
"excludeTemperature": False,
"excludeMotion": False,
"temperature": 76,
"status": "Ok",
Expand All @@ -229,15 +229,15 @@
},
{
"id": 2,
"roomName": "Master Bedroom",
"roomAvgTemp": 76,
"roomAvgHumidity": 52,
"name": "Master Bedroom",
"avgTemperature": 76,
"avgHumidity": 52,
"overallMotion": False,
"accessories": [
{
"id": 2,
"type": "IndoorAirSensor",
"excludeTemp": False,
"sensorType": "IndoorAirSensor",
"excludeTemperature": False,
"excludeMotion": False,
"temperature": 76,
"status": "Ok",
Expand Down
38 changes: 17 additions & 21 deletions tests/objects/test_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,70 @@ def test_priority(priority_fixture_response: dict):
"""Test priority object."""
obj = LyricPriority(priority_fixture_response)
assert obj.device_id == priority_fixture_response["deviceId"]
assert obj.status == priority_fixture_response["status"]
assert obj.status == priority_fixture_response["priorityStatus"]
assert (
obj.current_priority.priority_type
== priority_fixture_response["currentPriority"]["priorityType"]
== priority_fixture_response["priority"]["priorityType"]
)
assert (
obj.current_priority.selected_rooms[0]
== priority_fixture_response["currentPriority"]["selectedRooms"][0]
== priority_fixture_response["priority"]["selectedRooms"][0]
)
assert (
obj.current_priority.rooms[0].id
== priority_fixture_response["currentPriority"]["rooms"][0]["id"]
== priority_fixture_response["priority"]["rooms"][0]["id"]
)
assert (
obj.current_priority.rooms[0].room_name
== priority_fixture_response["currentPriority"]["rooms"][0]["roomName"]
== priority_fixture_response["priority"]["rooms"][0]["name"]
)
assert (
obj.current_priority.rooms[0].room_avg_temp
== priority_fixture_response["currentPriority"]["rooms"][0]["roomAvgTemp"]
== priority_fixture_response["priority"]["rooms"][0]["avgTemperature"]
)
assert (
obj.current_priority.rooms[0].room_avg_humidity
== priority_fixture_response["currentPriority"]["rooms"][0]["roomAvgHumidity"]
== priority_fixture_response["priority"]["rooms"][0]["avgHumidity"]
)
assert (
obj.current_priority.rooms[0].overall_motion
== priority_fixture_response["currentPriority"]["rooms"][0]["overallMotion"]
== priority_fixture_response["priority"]["rooms"][0]["overallMotion"]
)
assert (
obj.current_priority.rooms[0].accessories[0].id
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
"id"
]
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0]["id"]
)
assert (
obj.current_priority.rooms[0].accessories[0].type
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
"type"
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0][
"sensorType"
]
)
assert (
obj.current_priority.rooms[0].accessories[0].exclude_temp
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
"excludeTemp"
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0][
"excludeTemperature"
]
)
assert (
obj.current_priority.rooms[0].accessories[0].exclude_motion
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0][
"excludeMotion"
]
)
assert (
obj.current_priority.rooms[0].accessories[0].temperature
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0][
"temperature"
]
)
assert (
obj.current_priority.rooms[0].accessories[0].status
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
"status"
]
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0]["status"]
)
assert (
obj.current_priority.rooms[0].accessories[0].detect_motion
== priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][
== priority_fixture_response["priority"]["rooms"][0]["accessories"][0][
"detectMotion"
]
)