Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light entity: fix color conversion & verify color mode conversion for brightness #7

Closed
zehnm opened this issue Mar 17, 2023 · 2 comments · Fixed by #45
Closed

Light entity: fix color conversion & verify color mode conversion for brightness #7

zehnm opened this issue Mar 17, 2023 · 2 comments · Fixed by #45
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@zehnm
Copy link
Contributor

zehnm commented Mar 17, 2023

Verify brightness handling / conversion.

The brightness is now also sent as color_mode which leads to the following error message in the integration:
TODO light.theater_lights implement color mode conversion for color_mode: brightness.
However, brightness setting is still working.

https://developers.home-assistant.io/docs/core/entity/light/

@zehnm
Copy link
Contributor Author

zehnm commented Feb 1, 2024

The brightness, onoff and unknown color modes can be filtered out in the integration. They only generate log warnings.

What needs to be implemented is XY -> HS color mode conversion.

RGB* color modes need further investigation. I don't have any lights which return this color mode. Also, the automatic conversion in HA (through the WS API) is still a mystery :-) My Hue lights report XY color mode, but setting a color still works with the hs_color parameter.

@zehnm zehnm added the help wanted Extra attention is needed label Feb 1, 2024
@zehnm zehnm self-assigned this Feb 1, 2024
@zehnm
Copy link
Contributor Author

zehnm commented Feb 1, 2024

New insight: color change events from HA to the remote are broken:

  • only color_mode: hs is currently implemented, but HA seems to send xy by default. Also for Philips Hue.
  • There's a bug in the HS value extraction: saturation is scaled twice. Any value > 39 won't pass the value range check.

I start fixing it!

@zehnm zehnm added the bug Something isn't working label Feb 1, 2024
zehnm added a commit that referenced this issue Feb 2, 2024
Extract and convert color information from received HA light entities.
Supported color modes: hs, xy, rgb

Assumption: HA sends the color_mode of the light, plus converted color
models. For example if the color_mode is `rgb`, then `hs` and `xy` modes
are included as well.

Include color model conversions as fallback, since the HA documentation
isn't very specific about the returned data.

Fixes #7
@zehnm zehnm changed the title Light entity: verify color mode conversion for brightness Light entity: fix color conversion & verify color mode conversion for brightness Feb 2, 2024
@zehnm zehnm closed this as completed in #45 Feb 2, 2024
zehnm added a commit that referenced this issue Feb 2, 2024
Extract and convert color information from received HA light entities.
Supported color modes: hs, xy, rgb

Assumption: HA sends the color_mode of the light, plus converted color
models. For example if the color_mode is `rgb`, then `hs` and `xy` modes
are included as well.

Include color model conversions as fallback, since the HA documentation
isn't very specific about the returned data.

Fixes #7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant