MariusRumpf / node-lifx

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

Add option to stop discovery when predefined lights are found (base branch es2015) #61

Open ristomatti opened 7 years ago

ristomatti commented 7 years ago

I've used a prototype version of this implementation for quite some time to avoid lights dropping out occasionally in my node-red home automation setup.

If for example below settings are passed to client on init, the discovery process will stop after the listed lights have been discovered. This prevents discovery processing setting lights offline if they don't respond for some reason. I've found this does not necessarily prevent packets being processed on the lights.

{
  light: ['192.168.1.10', '192.168.1.11'],
  stopAfterDiscovery: true
}

Client will emit discovery-completed after the lights are found if the configuration option is enabled.

This PR is done against the base branch es2015 like my earlier PR #60 from today.

codecov-io commented 7 years ago

Codecov Report

Merging #61 into es2015 will increase coverage by 0.72%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           es2015      #61      +/-   ##
==========================================
+ Coverage   58.41%   59.13%   +0.72%     
==========================================
  Files          50       50              
  Lines        1688     1713      +25     
  Branches      255      259       +4     
==========================================
+ Hits          986     1013      +27     
+ Misses        702      700       -2
Impacted Files Coverage Δ
lib/lifx/client.js 90.66% <0%> (+1.57%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0468de6...62a4052. Read the comment docs.