Open Christanoid opened 2 days ago
To add to this ticket, the same in reverse would also be appreciated, since from what I can see I also do not have control over the individual LED's except for with the UDP Realtime API, however using that would require me to implement custom transitioning logic when trying to set a color palette.
Hi, a few thoughts on your request
. For example /state/currCol
We normally have hundreds of LEDs connected - how would you define "current color" when effects other than "solid" are running?
The "main color" from the color wheel can be checked and set via JSON or via http API: https://kno.wled.ge/interfaces/http-api/#xml-response
have control over the individual LED's
The "i" json tag can be used for this, however there are size limitations so normally you can't set all LEDs with one message. https://kno.wled.ge/interfaces/json-api/#per-segment-individual-led-control
Processing the "i" request is relatively slow - a few request per second is probably the max possible without making WLED unstable.
A new API command that returns the same kind of object as the websocket live stream would, but just once.
If you make a custom build with -D WLED_ENABLE_JSONLIVE
added to build_flags
, you get a second api for LEDs preview: json/live
. Just keep in mind that the JSON preview may be scaled down, because we only have buffer space for 256 leds.
how would you define "current color" when effects other than "solid" are running?
Good question, in my case I would want a snapshot of the current now. I have two cases for which I would like to use this color fetching. Firstly I want to disable any effects right after fetching the colors and start a UDP Stream to animate some features. And in order to not have a sudden jump in color upon starting the stream I would like to make sure I know what the stripe is displaying at the beginning of the animation so that I can easy into the Animation myself. Secondly I have tiles in my UI which just display a "blurred" version of the current colors, this blurred color fade is based on what the light is displaying and fetched upon loading the UI Page.
The "i" json tag can be used for this
Must have overlooked that while scrolling through the documentation, thanks for pointing that out
If you make a custom build with -D WLED_ENABLE_JSONLIVE added to build_flags
hm. yeah, I have read that there is a build tag that can extend abilities and it does appear to be pretty much what I want. I was hoping i'd be able to avoid custom builds so that I can keep comfortably updating my devices over homeassisstant. Maybe I'll stick with the websocket live on and off trigger then.
My current problem is that I would like to give a preview of what the lights are displaying at a given moment so that I can better prepare fading effects in the beginning of a UDP Stream.
Solution A new API command that returns the same kind of object as the websocket live stream would, but just once. For example /state/currCol or something else. In order to not further gunk up the /json/state message which can already be quite sizeable it might also be a good idea to leave it out of the state object.
Alternatives I have considered The only solution I can find to get all current colors is to enable the live stream in a Websocket (so to send {"lv":true}), wait for a single frame and then disable the stream again. This is not an elegant solution.