Closed Arlodotexe closed 1 year ago
Hi.
The json body must be based on Hue api and you can check how it is parsed here: https://github.com/diyhue/Lights/blob/master/ESP8266/Hue_Gradient_Lightstrip_WS2812/Hue_Gradient_Lightstrip_WS2812.ino#L692-L701
So it must look like: {"gradient": {"points": [ {"color": {"xy": {"x": 0.53, "y": 0.21}}}, {"color": {"xy": {"x": 0.13, "y": 0.2}}}, {"color": {"xy": {"x": 0.3, "y": 0.3}}}]}}
Note that the number of segments is dynamically updated based on the number of "points" from the request witch is a list, in my example are 3, but can be between 2 up to 10.
P.S. The emulated bridge must not be slow, here probably you have another issue.
GitHub
DIY lights with support for diyHue. Contribute to diyhue/Lights development by creating an account on GitHub.
I was poking through this source code quite a bit and saw this was possible, although I tried it and it caused a failure that rebooted the device for some reason.
The provided JSON does work though. Must have been a syntax error. Thank you @mariusmotea! Maybe worth adding to the docs?
Wait, gradients work, but I still need the ability to change individual LEDs for custom effects. It doesn't look like this is possible via the API, would I need to modify and compile my own firmware?
LEDs are grouped into virtual lights. There is no per pixel manipulation via api.
You can implement custom effects intro the firmware, check fireplace and candle effects that are already there. If you manage to add nice effects feel free to open a pull request with your changes.
It may be more appropriate to say that I'm trying to create dynamic effects using external sensors. Only illuminating where a person is standing, for example, without breaking Hue compatibility.
Seems like something I'd need to add support for under the /state/
endpoint. It wouldn't be compatible with Hue, but it would do the trick.
Background
I have DIYHue set up with this WS2812b strip and an ESP8266. Everything seems to be working normally. The emulated bridge is slow but it works, and can set scenes with gradients.
Output from the
detect
endpoint:Problem
Changing the entire strip works as expected:
But changing multiple/individual lights does not: