-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SetWaveform for flashing, pulsing and other effects #21
Comments
Release 0.4.0 does contain the setWaveform packet, which can be created using the packet directly. var Lifx = require('./lib/lifx').Client;
var packet = require('./lib/lifx').packet;
var constants = require('./lib/lifx').constants;
var client = new Lifx();
var packetObj = packet.create('setWaveform', {
isTransient: true,
color: {hue: 0, saturation: 65535 , brightness: 65535, kelvin: 3500},
period: 1,
cycles: 5,
skewRatio: 1,
// SAW, SINE, HALF_SINE, TRIANGLE, PULSE
waveform: constants.LIGHT_WAVEFORMS.indexOf('SAW')
}, client.source);
packetObj.target = 'F37A4311B857'; // light id
client.init();
client.send(packetObj, callback); There is no direct integration yet since this packet has lots of parameters and would be complex to abstract. It might make sense to utilize this in another module like |
I'm trying to get this to work... The first error I got was...
That was easy enough to fix... I'm know getting this error....
I haven't done any digging yet...but any ideas ? Thanks, David |
Any chance you could add a |
@devbobo I get the same |
I have not tested it, it is more of a brainstorming how to do it (in the light.js file for the library). The error is due to the fact that the @devbobo The problem I see is that this method is rather complex with all its parameters. I would prefer a solution where there are simple methods like flash, breath and so on. But I am open to suggestions. |
@MariusRumpf, yeah I'm all for breathe and pulse effect methods, just the Lifx remote API. |
|
Good work on this module, from my usage things are looking pretty flawless! I did however just struggle why the following line in the above example made no impact on the output:
I was changing it to 0,1,2,3 or 4 and not seeing any change when sending the packet. Turns out the constants file is defining an array of strings:
(indexes map to https://github.com/ppelleti/lifx-protocol-docs/blob/8a38d3d5060bd6cba562fa940459d9b637d55726/messages/light.md#waveform) But the code in
So the above sample is actually writing I was going to raise a PR to address this but I don't know the best approach to take? Should we just use the integer directly or should we be able to pass a string from the constants in and let that map back to it's int equivalent? |
@liamnichols Thanks, you are right. I updated my example above to pass digits to the packet creation wrapper by using the |
Just added an example how to use the raw method in 45c7ab8 |
This could be utilized to create effects like breath, pulsing and other.
The text was updated successfully, but these errors were encountered: