From 5e27b6b506e0d0d88b4333cd8ffac577d1f236c6 Mon Sep 17 00:00:00 2001 From: trip-g Date: Tue, 21 Jul 2026 13:31:13 -0400 Subject: [PATCH 1/2] Fix priority endpoint field names to match Resideo's live API schema LyricPriority/CurrentPriority/LyricRoom/LyricAccessory were reading JSON keys that don't match what the /devices/thermostats/{id}/priority endpoint actually returns. Captured directly from a live Resideo account (T9-T10 thermostat with paired RCHTSENSOR accessories): currentPriority -> priority status -> priorityStatus (top-level priority status) roomName -> name (per room) roomAvgTemp -> avgTemperature (per room) roomAvgHumidity -> avgHumidity (per room) type -> sensorType (per accessory) excludeTemp -> excludeTemperature (per accessory) Because current_priority previously read a nonexistent key, it silently defaulted to an empty object instead of raising - so every consumer got an empty room list with no error at all. This is what made room sensor/priority data appear to work (no exceptions) while actually returning nothing for any real thermostat. Updated the RESPONSE_JSON_PRIORITY test fixture and its assertions in tests/objects/test_priority.py to match the corrected schema; the previous fixture encoded the same wrong keys the code was reading, so tests passed without ever catching the mismatch against a real API response. Not changed: the currentPriority key sent by update_priority() (the POST body for setting room priority) is a separate, unverified code path - no live capture of that request/response yet to confirm it's also wrong. --- aiolyric/objects/priority.py | 14 ++++++------- tests/__init__.py | 34 ++++++++++++++++---------------- tests/objects/test_priority.py | 36 ++++++++++++++++------------------ 3 files changed, 41 insertions(+), 43 deletions(-) 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..528976b 100644 --- a/tests/objects/test_priority.py +++ b/tests/objects/test_priority.py @@ -7,74 +7,72 @@ 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][ + == 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" ] ) From 064269e8e620391aaef5c215687da3118d2e4013 Mon Sep 17 00:00:00 2001 From: trip-g Date: Tue, 21 Jul 2026 13:51:25 -0400 Subject: [PATCH 2/2] Apply black formatting to test_priority.py Co-Authored-By: Claude Sonnet 5 --- tests/objects/test_priority.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/objects/test_priority.py b/tests/objects/test_priority.py index 528976b..2f759fa 100644 --- a/tests/objects/test_priority.py +++ b/tests/objects/test_priority.py @@ -66,9 +66,7 @@ def test_priority(priority_fixture_response: dict): ) assert ( obj.current_priority.rooms[0].accessories[0].status - == priority_fixture_response["priority"]["rooms"][0]["accessories"][0][ - "status" - ] + == priority_fixture_response["priority"]["rooms"][0]["accessories"][0]["status"] ) assert ( obj.current_priority.rooms[0].accessories[0].detect_motion