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

Add support for "setRGB" command for light entity. #75

Merged
merged 18 commits into from
Jun 22, 2020
Merged

Conversation

vlebourl
Copy link
Collaborator

fix issue #73

@vlebourl vlebourl added enhancement New feature or request Needs Testing This needs extensive testing platform: light labels Jun 19, 2020
@vlebourl vlebourl self-assigned this Jun 19, 2020
@vlebourl vlebourl linked an issue Jun 19, 2020 that may be closed by this pull request
@iMicknl
Copy link
Owner

iMicknl commented Jun 19, 2020

Don't we need to pull this from the states as well? To show the current color.

@vlebourl
Copy link
Collaborator Author

Indeed we do. Added in the last commit.

@vlebourl vlebourl marked this pull request as ready for review June 19, 2020 15:01
Copy link
Owner

@iMicknl iMicknl left a comment

Choose a reason for hiding this comment

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

Nice work @vlebourl! Just a few comments + the debug strings could be removed. :)


if ATTR_HS_COLOR in kwargs:
rgb = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
self._rgb = [int(float(c)) for c in rgb]
Copy link
Owner

Choose a reason for hiding this comment

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

Can we already set self._rgb here? What if the command fails, in that case the state is incorrect?

Or should we implement this behavior in all integrations, where we directly update the state, but change it back if the command fails. (which happens via the update() function)

Copy link
Owner

Choose a reason for hiding this comment

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

This is one still applies, but is now renamed to self._hs_color

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, self._hs_color should be set in the update triggered after the turn_on, now that the command awaits for its completion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

isn't that the same for _brightness and _effect though?

Copy link
Owner

Choose a reason for hiding this comment

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

You are right, let's keep it for now to have the same behavior across this integration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, let me push that and we can merge.

custom_components/tahoma/light.py Outdated Show resolved Hide resolved
#Related Github issues: #75
@vlebourl vlebourl merged commit 64d40be into master Jun 22, 2020
@vlebourl vlebourl deleted the add_light_rgb branch June 22, 2020 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs Testing This needs extensive testing platform: light
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for IO RGB Light (io:DimmableRGBLightIOComponent)
2 participants