Adjust openrgb default color mode handling#162650
Conversation
|
Hey there @felipecrs, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
This PR adjusts the OpenRGB light entity’s default color_mode handling to align with recent core light validation changes (follow-up to #162276 / spotted in #162644), avoiding invalid/legacy None color mode handling and ensuring a valid fallback behavior.
Changes:
- Initialize
color_modewithColorMode.UNKNOWNinstead ofNone. - Update the fallback condition to treat
ColorMode.UNKNOWNas the “unset” state and default toColorMode.RGB.
| @@ -194,8 +194,8 @@ def _update_attrs(self) -> None: | |||
| # If Off by color, retain previous color mode to avoid changing the UI | |||
| color_mode = self._attr_color_mode | |||
|
|
|||
| if color_mode is None: | |||
| # If color mode is still None, default to RGB | |||
| if color_mode == ColorMode.UNKNOWN: | |||
| # If color mode is still unknown, default to RGB | |||
| color_mode = ColorMode.RGB | |||
There was a problem hiding this comment.
This change adjusts the fallback from None to ColorMode.UNKNOWN, which affects the initial/off-by-color/off-by-mode paths. There is currently no test asserting that an OpenRGB light starting in Off mode (or Off-by-color) reports valid supported_color_modes (i.e., not including ColorMode.UNKNOWN) and doesn’t trigger light color mode validation warnings. Add a test case covering these states to prevent regressions.
Proposed change
Follow-up to #162276
Spotted in #162644
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: