Add OpenRGB profile select entity#154732
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a select entity to the OpenRGB integration that allows users to select and apply OpenRGB profiles. The select entity dynamically updates its options based on available profiles and becomes unavailable when no profiles exist.
- Adds a new select platform with profile selection functionality
- Includes comprehensive test coverage for various scenarios including error handling
- Updates the main integration to include the select platform
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/openrgb/test_select.py | Comprehensive test suite covering entity setup, profile selection, error handling, and dynamic updates |
| tests/components/openrgb/snapshots/test_select.ambr | Snapshot test data for entity state validation |
| tests/components/openrgb/conftest.py | Adds profiles list and load_profile method to mock OpenRGB client |
| homeassistant/components/openrgb/strings.json | Translation strings for the profile select entity and error messages |
| homeassistant/components/openrgb/select.py | Implementation of the OpenRGB profile select entity |
| homeassistant/components/openrgb/init.py | Adds SELECT platform to the list of supported platforms |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
2f38f26 to
73ed447
Compare
|
Usually the is no need to constantly merge the dev branch, unless there is a conflict due to changes from another PR |
|
The last one was because of #155095. But you're right. I should do it less often. The contributor guide suggests rebasing after a week of inactivity. |
| self._state_hash = self._compute_state_hash() | ||
| # Only check for state changes if we have a current option to potentially clear | ||
| elif self._attr_current_option is not None: | ||
| current_hash = self._compute_state_hash() | ||
| # If state changed, we can no longer assume current profile | ||
| if current_hash != self._state_hash: | ||
| self._attr_current_option = None | ||
| self._state_hash = None |
There was a problem hiding this comment.
Why do we need the hash? Can't we check based on name?
There was a problem hiding this comment.
Which name?
OpenRGB SDK does not expose data of the current profile. I crafted this method so that I can at least determine whether the applied profile is still active.
Please read this discussion for a better context.
There was a problem hiding this comment.
I improved the hash function a little bit by reusing @jath03's idea.
Also, this will be simplified in future. The author of OpenRGB accepted the suggestion of tracking this within OpenRGB itself.
745095b to
efda077
Compare
|
Thanks a lot, @joostlek! |


Proposed change
This adds a select entity for selecting/applying a profile in OpenRGB. Here's how it works:
A little demo:
chrome_vy7QEc28QP.mp4
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: