node-lifx / lifx-lan-client

Canonical fork of the number one Node.js 💡 LIFX LAN protocol implementation.
MIT License
42 stars 19 forks source link

Changing hue values works strangely #5

Open Sawtaytoes opened 5 years ago

Sawtaytoes commented 5 years ago

Reference: https://twitter.com/Sawtaytoes/status/1135765147425918978

The issue I'm having is that sending 12743 sets it to 12544. Sending anything up to, but not including 12800 sets it to 12544. The only way I got it to change the hue was by passing 12800.

Word from the LIFX Devs:

Our team is unable to debug your node code, but to convert hue=70 to a uint we get uint16(70 0xFFFF / 360) = 12742 and converting back we get float64(12742)360/0xFFFF = 69.994965 - sorry we couldn't be more helpful, but try our forum Source: https://twitter.com/LIFX/status/1136802118096998400

ristomatti commented 5 years ago

Which LIFX lights are in question BTW? There's for example differences between the supported Kelvin ranges between Original and Mini Color bulbs.

Sawtaytoes commented 5 years ago

Actually, 3rd gen A19s and BR30s support 1500K now. I tested via the LIFX app recently.

The issues I was having were tested on 3rd gen A19 and BR30 bulbs.

Sawtaytoes commented 5 years ago

This image best describes the issue: image

Looks at the receiving and sending values.

I added logging in lifx-lan-client where the send and receives were occurring.

ristomatti commented 5 years ago

@Sawtaytoes I read this again and remembered I've noticed similar issues with brightness values. It didn't bother me that much as the difference was too small to notice on the actual lights. But it definitely seems either the light firmware has an issue or there's a bug in the packet creation or interpretation. Have you checked if you can reproduce the issue with other libraries?

Sawtaytoes commented 5 years ago

I have not tried other libraries.

I was working on sending the command myself with a UDP packet to see if that would also show the issue. Then I could send this to the LIFX devs since there's a potential firmware flaw.

This affects me because I toggle scenes. I can't toggle scenes if the values of the lights are different from the saved values in the HTTP API.