Skip to content

Fix priority endpoint field names to match Resideo's live API schema - #165

Merged
timmo001 merged 2 commits into
timmo001:masterfrom
clutch2sft:fix/priority-endpoint-field-names
Aug 10, 2026
Merged

Fix priority endpoint field names to match Resideo's live API schema#165
timmo001 merged 2 commits into
timmo001:masterfrom
clutch2sft:fix/priority-endpoint-field-names

Conversation

@clutch2sft

@clutch2sft clutch2sft commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

LyricPriority/CurrentPriority/LyricRoom/LyricAccessory read JSON keys that don't match
what GET /devices/thermostats/{id}/priority actually returns from a live Resideo account today.
Because current_priority reads a key that doesn't exist, it silently falls back to {} instead
of raising — so every consumer gets an empty room list with no error, no exception, nothing
logged
. This makes the bug very easy to miss: the HTTP call succeeds (200), the debug log even
shows a full, correct payload, and the parsed objects are just quietly empty.

Captured directly from a live T9/T10 thermostat with three paired RCHTSENSOR room accessories:

Property Reads key Actual API key
LyricPriority.current_priority currentPriority priority
LyricPriority.status status priorityStatus
LyricRoom.room_name roomName name
LyricRoom.room_avg_temp roomAvgTemp avgTemperature
LyricRoom.room_avg_humidity roomAvgHumidity avgHumidity
LyricAccessory.type type sensorType
LyricAccessory.exclude_temp excludeTemp excludeTemperature

(Example payload and full JSON in the file — see pr-aiolyric-priority.md.)

Changes

  • aiolyric/objects/priority.py: updated the 7 properties above to read the correct keys.
  • tests/__init__.py: updated RESPONSE_JSON_PRIORITY to the corrected schema. The previous
    fixture encoded the same wrong keys the code was reading, so test_priority.py passed without
    ever catching the mismatch against a real response.
  • tests/objects/test_priority.py: updated assertions to match.

pytest tests/objects/ passes (3/3). Note: tests/test_client.py and tests/test_init.py fail
in my environment on an unrelated aioresponses/aiohttp version incompatibility — reproduces on
master too, before this change, so it's a local environment issue, not something this PR
introduces.

What I deliberately did NOT change

update_priority() (the POST body for setting room priority) still sends
{"currentPriority": {...}}. I don't have a captured live request/response for the write path to
confirm whether it has the same mismatch, so I left it alone rather than guess.

Context

Found while fixing a related bug in Home Assistant's lyric integration, which was silently
skipping the priority fetch entirely for some thermostats: home-assistant/core#177022. Once
merged and released to PyPI, that PR would need a version bump in
homeassistant/components/lyric/manifest.json to pick it up.

clutch2sft and others added 2 commits July 21, 2026 13:31
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.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
clutch2sft added a commit to clutch2sft/aiolyric that referenced this pull request Jul 21, 2026
Resideo's API returns "scheduleSubtype" (lowercase t) for both device
and location responses, not "scheduleSubType". Found while auditing
device.py for the same class of field-name mismatch fixed in the
priority endpoint (timmo001#165). Not currently consumed anywhere in
Home Assistant's lyric integration, so this was never visibly broken,
but the fixtures encoded the same wrong key the code was reading, so
the existing tests passed without ever catching it against a real
response.
clutch2sft added a commit to clutch2sft/core that referenced this pull request Jul 28, 2026
joostlek pushed back on shipping xfail-marked entities directly
(vacation_hold, room_motion), consistent with abmantis's separate
"keep as draft until the dependency lands" stance on the Priority
Status sensor PR. Rather than argue two reviewers down independently,
split scope: this PR now ships only device_pairing_enabled, which
works today against the currently-pinned aiolyric. vacation_hold and
room_motion move to a held-back branch
(binary-sensor-vacation-hold-room-motion) to resume once
timmo001/aiolyric#165 and the vacation-hold-key fix release.

- Remove ACCESSORY_BINARY_SENSORS/LyricAccessoryBinarySensor and the
  vacation_hold DEVICE_BINARY_SENSORS entry from binary_sensor.py, and
  their strings.json entries - dead code with only one entity left.
- Drop the now-unused priority.json fixture and the rooms_dict/
  priorities_dict setup in mock_lyric_api; nothing left needs room data.
- Replace the three hand-written entity tests (one xfail, two working)
  with a single snapshot_platform test, and drop the direct value_fn/
  suitable_fn unit tests - joostlek's other point on this PR. With only
  one entity and a suitable_fn that's always True, there's nothing left
  for those to usefully cover beyond what the snapshot already asserts.
@clutch2sft

Copy link
Copy Markdown
Contributor Author

@timmo001 — when you get a chance, could you take a look at this one?

I've been working through T9/T10 room-sensor support in Home Assistant and ended up tracing several issues back into aiolyric. This PR (#165) is the important one: the priority endpoint currently parses several field names differently from what the live Resideo API actually returns, causing the room/priority data to silently come back empty.

I've captured the live API response, updated the fixture/tests to match it, and deliberately left the unverified POST path alone rather than guessing.

This is also now an upstream blocker for my related Home Assistant Core work, particularly home-assistant/core#177022. The HA-side changes can fix when/how the priority endpoint is called, but the room data still can't populate correctly until the parsing fix here is adopted and an aiolyric release containing it is available.

There is some additional work I need to do on the Core PRs based on subsequent review/changes there, but I'd prefer not to keep reworking the downstream implementation until I know the required upstream library fix has a path forward.

While auditing the surrounding aiolyric objects I found a few other small live-API/schema discrepancies and opened #166#170 separately to keep each change focused.

I'm happy to restructure, combine, squash, or otherwise adjust these PRs however you'd prefer. Mainly wanted to make sure #165 in particular hadn't fallen off your radar, since it's currently holding up the downstream HA work.

Thanks!

@timmo001 timmo001 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @clutch2sft !

@timmo001
timmo001 merged commit 8bceb6a into timmo001:master Aug 10, 2026
4 of 10 checks passed
timmo001 pushed a commit that referenced this pull request Aug 10, 2026
* Fix ScheduleType.schedule_sub_type reading the wrong JSON key

Resideo's API returns "scheduleSubtype" (lowercase t) for both device
and location responses, not "scheduleSubType". Found while auditing
device.py for the same class of field-name mismatch fixed in the
priority endpoint (#165). Not currently consumed anywhere in
Home Assistant's lyric integration, so this was never visibly broken,
but the fixtures encoded the same wrong key the code was reading, so
the existing tests passed without ever catching it against a real
response.

* Support both scheduleSubType and scheduleSubtype keys

Resideo's docs specify scheduleSubType, but the live API sends
scheduleSubtype (lowercase t). Check the documented key first and
fall back to the observed one so neither response shape reads back
None.

Addresses review feedback on #166.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants