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

Update core HSV color scaling to standard scales: #12649

Merged
merged 1 commit into from Feb 27, 2018
Merged

Conversation

emlove
Copy link
Contributor

@emlove emlove commented Feb 25, 2018

Description:

Related to #11288

This PR updates the scaling used internally in hass for HSV values. The current scales were pretty much directly catered to the hue platform. This PR introduces some more standardized scales, before we open up HSV as part of the light API.

Hue is scaled 0-360
Sat is scaled 0-100
Val is scaled 0-100

Hue is scaled 0-360
Sat is scaled 0-100
Val is scaled 0-100
Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@amelchio amelchio left a comment

Choose a reason for hiding this comment

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

We should probably cast to integers before passing the values to device APIs. I will check how aiolifx handles floats.

@emlove
Copy link
Contributor Author

emlove commented Feb 26, 2018

I did test with hue, and it works fine. I don't have any lifx devices, but I can add a cast for those if we want to be extra conservative.

@amelchio
Copy link
Contributor

It seems to also work for LIFX. With aiolifx, the message is packed with bitstring.pack and that truncates the float:

>>> bitstring.pack("uint:16", 1.9)
BitStream('0x0001')

@emlove emlove merged commit c1a6131 into dev Feb 27, 2018
@emlove emlove deleted the hsv-core-scaling branch February 27, 2018 03:20
@lwis lwis mentioned this pull request Mar 4, 2018
@amelchio amelchio mentioned this pull request Mar 7, 2018
2 tasks
@balloob balloob mentioned this pull request Mar 9, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
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.

None yet

4 participants