node-lifx icon indicating copy to clipboard operation
node-lifx copied to clipboard

Add methods to retrieve uptime and reboot bulb

Open jasoncodes opened this issue 7 years ago • 3 comments

Tested with LIFX Original.

I use these to monitor device uptime and reboot the bulb when connection to the cloud is lost and does not automatically reconnect.

The uptime call is officially documented. The reboot request packet was found via the no longer supported Ruby gem. The reboot response packet was found via a packet capture.

jasoncodes avatar Nov 25 '17 13:11 jasoncodes

@jasoncodes this looks awesome, thanks! I'll give it a try when I have the time. I wasn't aware about this functionality myself.

Please bear with us as it might take quite some time until this progresses any further since @MariusRumpf has been taking time off the project. I've been given access to merge PR's but to be perfectly honest I don't feel comfortable doing that as I don't have enough information on if the develop branch should be part of the next npm release. And even if I did, I don't have the required keys to publish an npm release anyhow.

The tests seem to be failing though due to an unexpected character and a linting error. You'll spot the errors with npm run lint.

ristomatti avatar Nov 29 '17 10:11 ristomatti

I tested this and both uptime and reboot seem to work. In case you're interested I merged this to master on my own fork and rebased my open PR's #60 and #61 on top of it. I also updated TypeScript typings and the interactive-cli.js example with the new functions. The stuff can be found here: https://github.com/ristomatti/node-lifx/tree/es2015-dev

Note that this is a branch for my own use of the library mainly with Node-RED.

ristomatti avatar Nov 29 '17 11:11 ristomatti

@jasoncodes Forgot to ask if you know what the uptime figure returned is? I get a floating point number which did not seem to make much sense.

Also in case you want to try out my branch mentioned in my previous comment, note that it's based on my es2015 branch which introduces Babel and requires npm run build before using. If you have a lot of lights, I believe you'll find the changes on #60 quite nice. Changes to multiple lights are almost instant then. :)

ristomatti avatar Nov 29 '17 11:11 ristomatti