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

Get color of light #43

Open
CantinaBots opened this issue Jul 28, 2021 · 1 comment
Open

Get color of light #43

CantinaBots opened this issue Jul 28, 2021 · 1 comment

Comments

@CantinaBots
Copy link

Hi, great API you made here. I've been enjoying it. I do have one question. I am using this to change the color of my Lightstrip based on other info I'm pulling. It does this like every five minutes. I'm wondering if there is some way I can check the current color of the lightstrip? The issue is that say x happens so the light will remain green. My program turns the light green and sets the brightness to max. However, each time it checks it is setting the light to green (dims light) then changes the brightness to max. This causes the lights to kind of change a little every time I check rather than staying one solid color.

Wondering if there is a way for me to implement this better?

@ZeroOne3010
Copy link
Owner

Hey, thanks for your message! :) Reading the colors back from the lights is a bit tricky, that's why it has not exactly been implemented. See, the API returns the color as x and y coordinates. For example, "xy": [0.6915, 0.3083] corresponds to a certain shade of red, whereas "xy": [0.17, 0.7] is green. I probably could create a mapping from those coordinates back to some understandable value, but for now your best bet is to read Light.getState().getXy() and to compare those values with some known values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants