diff --git a/aiolyric/objects/priority.py b/aiolyric/objects/priority.py index c31a16a..89fac59 100644 --- a/aiolyric/objects/priority.py +++ b/aiolyric/objects/priority.py @@ -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): @@ -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): @@ -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", {})) diff --git a/tests/__init__.py b/tests/__init__.py index ee93752..396aec4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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", @@ -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", @@ -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", diff --git a/tests/objects/test_priority.py b/tests/objects/test_priority.py index 4eaa5bd..2f759fa 100644 --- a/tests/objects/test_priority.py +++ b/tests/objects/test_priority.py @@ -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" ] )