MariusRumpf / node-lifx

Node.js implementation of the LIFX LAN protocol :bulb:
MIT License
144 stars 28 forks source link

Infrared support for new LIFX+ #42

Closed bmv437 closed 7 years ago

bmv437 commented 7 years ago

This is in response to Issue #40

Support for getInfrared, setInfrared, stateInfrared packets. maxIR(brightness) and getMaxIR() functions for light objects. unit tests for maxIR() and getMaxIR().

Note: I don't own any LIFX+ bulbs, so I can't actually test that this works yet. If anyone has a LIFX+ bulb, please give this branch a try and report any issues.

codecov-io commented 7 years ago

Current coverage is 57.88% (diff: 59.01%)

Merging #42 into master will increase coverage by 0.05%

@@             master        #42   diff @@
==========================================
  Files            42         45     +3   
  Lines          1252       1313    +61   
  Methods         103        110     +7   
  Messages          0          0          
  Branches        195        202     +7   
==========================================
+ Hits            724        760    +36   
- Misses          528        553    +25   
  Partials          0          0          

Powered by Codecov. Last update 1a01749...aeb4cad

ristomatti commented 7 years ago

I received few LIFX+ bulbs and LIFX Z strips yesterday. I tested the code and it appears to be working without any tweaking. Great work @bmv437!

Interestingly I could not find where to set the IR LED brightness in the official Android app. What the app currently does is turn on the IR LED to 100% when the bulb has <10% brightness or when it is toggled off. So with the official app you cannot cucrently turn off the IR LED off in any other means then using a physical switch..

ristomatti commented 7 years ago

I wanted to have this for my own project that uses node-lifx. In the process of getting this and the latest changes in node-lifx combined, I squashed the three commits, fixed merge conflicts and pushed the changes to my fork (https://github.com/ristomatti/node-lifx/tree/feature/infrared_support). If it's of any use I can make a PR from there? The original committer info has been preserved when squashing.

In case someone is interested in testing the IR brightness control it can be done using my interactive CLI lifxsh with some effort (IR feature is only in a dev branch):

git clone git@github.com:ristomatti/lifxsh.git
git checkout ir-brightness
npm install
npm run build
node dist/cli.js

Usage info can be found from the README I just got myself into writing.

MariusRumpf commented 7 years ago

Thanks a lot, merged with help of @ristomatti to develop and just landed in newest release.