Experimental support for setting light waveforms#5
Conversation
The feature is only experimental as: - the current implementation uses raw packets as there's no official support for the command on lifx-lan-client - there's no validation for the input properties - brightness and hue values use 0-65535 range instead of 0-100 / 0-360 - node's info tab documentation is missing
|
Node red has a range node that I guess could be used to map the new ranges. |
|
@Andobi Yep using range node would definitely be a good workaround. However I don't like the inconsistency between commands within the library so it would be nice to fix at some point. Lifx-lan-client has a similar partial support for setting the waveform (which the code here uses), so yes it should work. You can instal this similarly as the previous one with: npm install ristomatti/node-red-contrib-node-lifx#feature/set-waveformNo need to remove the previous version. This also includes all the previous changes. You can import the below two nodes and connect them to a light to test. [{"id":"4a5eb957.0ec0a8","type":"inject","z":"541dcf12.49751","name":"waveform","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":800,"wires":[["c46a327b.e2eb6"]]},{"id":"c46a327b.e2eb6","type":"template","z":"541dcf12.49751","name":"set waveform","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"isTransient\": true,\n \"color\": {\"hue\": 0, \"saturation\": 65535, \"brightness\": 65535, \"kelvin\": 3500},\n \"period\": 800,\n \"cycles\": 3,\n \"skewRatio\": 0,\n \"waveform\": \"SINE\"\n}","output":"json","x":290,"y":800,"wires":[["9e9f6f52.eae85"]]}] |
|
Alright then! That's good. I'll test it out shortly. |
This worked, but it was scary. I'm going to mess with the numbers to make it less violent. |
|
This is nicer. I'm starting from white. There is a weird double pulse around the starting point using SINE |
|
Great! I agree the provided example was quite violent. I'll merge this and see if I could get also the npm package updated. |
|
@Andobi You can now just |
|
That's awesome, good job. I'm very happy as my kitchen lights are now in sync with the transition to red without any complicated node red flows. |
|
From the documentation and from discussions at the LIFX forum, it seems preferable to use setWaveformOptional instead of setWaveform.
Sadly that didn't work, gives an error in node red:
Also the docs state:
So will have to scale all of them |
Glad to help! Some of these changes will be useful to me also.
Yes. Actually support for the There's also a PR for the tile support but it's gone stale. I think the implementation needs furher refining before it can be added. I haven't had time to look into it as it's a lot more complicated feature. I cannot give any estimate when this will be progressed. One reason for lack of motivation to add the Tile support is that someone has already created a very nicely documented Tile effects library lifx-tile-effects-framework which uses node-lifx-lan (another LIFX client library). I believe it would be less work to create a Node-RED wrapper for that instead. |
You were on the right track there but in addition to uncommenting |
|
Thanks, I've had a look at that but it's definitely beyond me at the moment. |
|
For anyone else looking at this, here is a hsb scaler subflow, feed the usual payload in and it will come out the other end with adjusted values. |
This merges jdomeij#8 and adapts it to work with the changes on this fork.
The feature is marked experimental as:
official support for the command on lifx-lan-client
0-100 / 0-360
Example payload to test (note the raw saturation and brightness ranges):
Closes #4.