Skip to content

Add room priority select entity to Lyric integration#167942

Merged
joostlek merged 9 commits into
home-assistant:devfrom
yonib05:lyric-room-priority-select
May 26, 2026
Merged

Add room priority select entity to Lyric integration#167942
joostlek merged 9 commits into
home-assistant:devfrom
yonib05:lyric-room-priority-select

Conversation

@yonib05

@yonib05 yonib05 commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Breaking change

Proposed change

Honeywell T9/T10 thermostats support room priority — the ability to pick which wireless room sensor the thermostat uses for its temperature reading. The `aiolyric` library already fetches this data via the `/priority` API endpoint and has an `update_priority` method, but the HA integration doesn't expose it.

This adds a select entity per LCC thermostat that has room sensors, letting users pick which room has priority or switch to "Follow Me" (motion-based). Options are built from the rooms the API returns for each thermostat.

The coordinator reads priority state from `aiolyric`'s `priorities_dict` property when available. The write path uses the existing `update_priority` method.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Upstream dependencies

This PR requires changes in `aiolyric` before it can be merged:

  1. Store LyricPriority object in priorities_dict timmo001/aiolyric#138 — Stores the `LyricPriority` object in a new `priorities_dict` property so the coordinator can read `priority_type` and `selected_rooms`. The coordinator uses `hasattr` to check for this property and only populates priority data when the library version supports it.
  2. Fix update_priority functionality to support T9 and T10 with sensors timmo001/aiolyric#134 — Fixes `update_priority` to use PUT instead of POST and corrects `selectedRooms` handling for non-PickARoom types. Required for the write path.

Once both are merged and released, `manifest.json` will need a version bump in a follow-up PR.

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (`ruff format homeassistant tests`)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: `python3 -m script.hassfest`.
  • New or updated dependencies have been added to `requirements_all.txt`.
    Updated by running `python3 -m script.gen_requirements_all`.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

No manifest or dependency changes in this PR. The `select` platform uses the existing `aiolyric` dependency. The manifest and requirements files will be updated in a follow-up PR when the aiolyric version is bumped.

To help with the load of incoming pull requests:

Adds a select entity per LCC thermostat that has room sensors,
allowing users to choose which room's temperature reading the
thermostat should prioritize. Options are dynamically built from
the thermostat's linked rooms.

Supported priority modes:
- Follow Me: auto-switch based on motion detection
- <Room Name>: use a specific room sensor (PickARoom)

Depends on:
- aiolyric storing LyricPriority in priorities_dict (library PR pending)
- aiolyric PR home-assistant#134 (fix update_priority POST->PUT)
Copilot AI review requested due to automatic review settings April 10, 2026 21:51

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @yonib05

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @timmo001, mind taking a look at this pull request as it has been labeled with an integration (lyric) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of lyric can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign lyric Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@yonib05

yonib05 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Testing

Tested on a live setup with 4 T9/T10 thermostats and 5 RCHTSENSOR room sensors on HA 2026.4.1.

All 4 LCC thermostats with room sensors got a select entity. Each correctly reads the current priorityType (PickARoom) and maps selectedRooms to the room name. Thermostats without room sensors (TCC devices like the Lyric Round) correctly get no select entity.

The write path has not been tested yet — it depends on timmo001/aiolyric#134.

The coordinator now fetches priority data directly from the Honeywell
API if the aiolyric library doesn't expose priorities_dict. This
allows the select entity to work with the current aiolyric 2.0.2
without requiring a library upgrade for the read path.

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @yonib05

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@yonib05

yonib05 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

Pushed a fix for the two ruff failures:

  • PLC0415 / SLF001: Removed the fallback path that was fetching priority data directly via the aiolyric client. It required a method-level import and accessed a private member (_client), both of which ruff correctly flagged.

The coordinator now only reads priorities_dict from the Lyric object when the property exists (hasattr check). This means the select entity depends on timmo001/aiolyric#138 being merged and released for the read path to work. Without it, the entity will be created but current_option will return None until the library is updated.

This is the cleaner approach — no workarounds in HA code for missing library functionality.

@yonib05

yonib05 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor Author

The codecov/patch failure is expected — this integration doesn't have entity tests for any platform (climate, sensor, or now select). The required codecov checks pass.

Adding select-only tests would require building out the full coordinator mock infrastructure (OAuth flow, Lyric client, location/device/room fixtures) since none of that exists yet. Happy to do that as a separate PR if preferred, but didn't want to mix test scaffolding into a feature PR.

@yonib05 yonib05 marked this pull request as ready for review April 11, 2026 17:35
@home-assistant home-assistant Bot dismissed stale reviews from themself April 11, 2026 17:35

Stale

Comment on lines +81 to +82
if hasattr(self.lyric, "priorities_dict"):
self.priorities_dict = self.lyric.priorities_dict

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the Lyric object never has priorities_dict as attribute, what's going on?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That property is added in timmo001/aiolyric#138. The hasattr check was meant as a forward-compatibility guard so the coordinator doesn't break on the current library version, but I agree it reads as confusing without context. I'll remove the guard and add the priorities_dict access unconditionally once the aiolyric bump lands.

@home-assistant home-assistant Bot marked this pull request as draft April 14, 2026 19:33
@joostlek

Copy link
Copy Markdown
Member

Let's keep it in draft until that dependency update has been fixed

@yonib05

yonib05 commented Apr 19, 2026

Copy link
Copy Markdown
Contributor Author

Removed the hasattr guard — priorities_dict is accessed directly now. That property is added in timmo001/aiolyric#138.

Will update and mark ready for review once the upstream dependencies are merged and the aiolyric version is bumped.

@timmo001

timmo001 commented May 6, 2026

Copy link
Copy Markdown
Member

Removed the hasattr guard — priorities_dict is accessed directly now. That property is added in timmo001/aiolyric#138.

Will update and mark ready for review once the upstream dependencies are merged and the aiolyric version is bumped.

https://github.com/timmo001/aiolyric/releases/tag/2.1.0 released 👍

The upstream release includes priorities_dict property and
update_priority fix needed for the room priority select entity.
@yonib05 yonib05 marked this pull request as ready for review May 8, 2026 14:58
@home-assistant home-assistant Bot requested a review from joostlek May 8, 2026 14:58
@yonib05

yonib05 commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Bumped aiolyric to 2.1.0 in manifest and requirements. Marked ready for review.

"iot_class": "cloud_polling",
"loggers": ["aiolyric"],
"requirements": ["aiolyric==2.0.2"]
"requirements": ["aiolyric==2.1.0"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please bump in a separate PR

@yonib05 yonib05 May 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ack, moved the version bump out. I'll submit it as a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Separate PR for the bump: #171007

and device.device_id.startswith("LCC")
)
)
self.priorities_dict = self.lyric.priorities_dict

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we store this as a variable on the coordinator? coordinator.data, which is the return value of _async_update_data is seen as the state of the coordinator. the data in this case is self.lyric, so I think it's more correct to get the priorities from coordinator.data...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Removed the extra attribute — the select entity now reads directly from coordinator.data.priorities_dict since that's where the authoritative state lives.

@home-assistant home-assistant Bot marked this pull request as draft May 12, 2026 17:13
….data

- Revert aiolyric version bump (will be a separate PR)
- Remove priorities_dict attribute from coordinator
- Read priorities directly from coordinator.data.priorities_dict
@yonib05 yonib05 mentioned this pull request May 17, 2026
21 tasks
@yonib05 yonib05 marked this pull request as ready for review May 17, 2026 17:44
@home-assistant home-assistant Bot requested a review from joostlek May 17, 2026 17:44

@joostlek joostlek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The CI is failing, can you take a look?

@home-assistant home-assistant Bot marked this pull request as draft May 18, 2026 18:25
- Remove `from __future__ import annotations` (banned, Python 3.14+)
- Raise HomeAssistantError instead of swallowing exception in
  async_select_option
@yonib05 yonib05 marked this pull request as ready for review May 20, 2026 15:52
@home-assistant home-assistant Bot requested a review from joostlek May 20, 2026 15:53
@joostlek joostlek merged commit 4bd0117 into home-assistant:dev May 26, 2026
32 of 33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants