xled / xled-docs

📖 Unofficial documentation of API reference, protocol details and hardware of Twinkly - Smart Decoration LED lights for Christmas.

Home Page:https://xled-docs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Way to tell if lights are on or off

chrisndeca opened this issue · comments

So I found a way to figure out if the lights are on or not, do a GET request to
/xled/v1/led/mode/status

the responses I got were:
{"mode":"off","code":1000}
{"mode":"effect","code":1000}
{"mode":"movie","code":1000}

I haven't figured out the RT mode yet, so I am just going to have to guess it would return a mode of RT if it were in RT mode.

This helps me because my lights sometimes fail to turn on via a cron script I have running. The response comes back as an error that the "connection has been reset by peer". So being able to poll the lights to find out if they are on is easier than try to parse errors.

Apparently lights accepts both: /xled/v1/led/mode/status and /xled/v1/led/mode. I have updated documentation to include second one.

{"mode":"effect","code":1000} seems to be gen2. I haven't wrote down those yet.

I haven't figured out the RT mode yet, so I am just going to have to guess it would return a mode of RT if it were in RT mode.

Getting status of RT mode is the same as any other.


From what I can tell mode: off means a device is connected to network but lights are turned off. Any other mode might mean LEDs are turned on. Well, except if you try to play a movie/effect that doesn't light up any LED of course.