From 9e52eb820f283353e40bde5a819b8c4e06ab2d11 Mon Sep 17 00:00:00 2001 From: JD Steffen Date: Sun, 6 Aug 2017 21:08:23 -0500 Subject: [PATCH] Change the name of the node to better match Node Red naming conventions. Changed some very minor grammer issues in the HTML and README files. Added support for activating the built in effect modes. Added support for changing the white color temperature on full color bulbs. --- .gitignore | 3 ++ README.md | 18 +++++++-- MiLight.html => milight.html | 49 +++++++++++++++---------- MiLight.js => milight.js | 71 ++++++++++++++++++++++++++++++++++-- package.json | 2 +- 5 files changed, 116 insertions(+), 27 deletions(-) rename MiLight.html => milight.html (53%) rename MiLight.js => milight.js (65%) diff --git a/.gitignore b/.gitignore index 123ae94..3652965 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,9 @@ coverage # node-waf configuration .lock-wscript +# package lock files +package-lock.json + # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release diff --git a/README.md b/README.md index 51ba495..a2ca1f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # node-red-contrib-milight -A Node Red nodes to control all bulb types Milight LED bulbs and OEM equivalents such as Rocket LED, Limitless LED Applamp, Easybulb, s'luce, iLight, iBulb, and Kreuzer. +A Node Red node to control Milight LED bulbs and their OEM equivalents such as Rocket LED, Limitless LED Applamp, Easybulb, s'luce, iLight, iBulb, and Kreuzer. ## Install @@ -8,7 +8,7 @@ A Node Red nodes to control all bulb types Milight LED bulbs and OEM equivalents ## Example Flow - [{"id":"b5ab74d6.08edc8","type":"MiLight","z":"44cc4fb7.965b3","name":"White Bulb / Legacy Bridge","bridgetype":"legacy","bulbtype":"white","zone":1,"ip":"255.255.255.255","broadcast":true,"x":1035.765625,"y":297,"wires":[]},{"id":"51aa22c0.74d05c","type":"MiLight","z":"44cc4fb7.965b3","name":"Color Bulb / Legacy Bridge","bridgetype":"legacy","bulbtype":"rgbw","zone":1,"ip":"255.255.255.255","broadcast":true,"x":1036.7656211853027,"y":619.0000314712524,"wires":[]},{"id":"26ce02ea.cd2e6e","type":"inject","z":"44cc4fb7.965b3","name":"Off","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":534.7656402587891,"y":553.0000228881836,"wires":[["51aa22c0.74d05c"]]},{"id":"17bef0b.fe9ce0f","type":"inject","z":"44cc4fb7.965b3","name":"On","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":534.7656555175781,"y":607.0000152587891,"wires":[["51aa22c0.74d05c"]]},{"id":"44e9d122.6a83b","type":"inject","z":"44cc4fb7.965b3","name":"white","topic":"","payload":"white","payloadType":"str","repeat":"","crontab":"","once":false,"x":536.765625,"y":662.9999933242798,"wires":[["51aa22c0.74d05c"]]},{"id":"b477791.b31d088","type":"inject","z":"44cc4fb7.965b3","name":"Brightness 10%","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"x":568.765625,"y":732,"wires":[["e01cd3d0.06b27"]]},{"id":"e01cd3d0.06b27","type":"function","z":"44cc4fb7.965b3","name":"","func":"msg.command = 'brightness';\nreturn msg;","outputs":1,"noerr":0,"x":741.7656478881836,"y":757.0000553131104,"wires":[["51aa22c0.74d05c"]]},{"id":"865a0a9b.be0848","type":"inject","z":"44cc4fb7.965b3","name":"Color","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"x":536.7656307220459,"y":843.0000419616699,"wires":[["f578b6a1.3d7948"]]},{"id":"f578b6a1.3d7948","type":"function","z":"44cc4fb7.965b3","name":"","func":"msg.command = 'color';\nreturn msg;","outputs":1,"noerr":0,"x":738.7657089233398,"y":845.000057220459,"wires":[["51aa22c0.74d05c"]]},{"id":"2cc2747e.452f4c","type":"inject","z":"44cc4fb7.965b3","name":"On","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":540.7656326293945,"y":168.00000381469727,"wires":[["b5ab74d6.08edc8"]]},{"id":"c8b4fa4d.e53078","type":"inject","z":"44cc4fb7.965b3","name":"Off","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":540.2656383514404,"y":215.00000190734863,"wires":[["b5ab74d6.08edc8"]]},{"id":"9fb07ff8.51bba","type":"inject","z":"44cc4fb7.965b3","name":"Warmer","topic":"","payload":"warmer","payloadType":"str","repeat":"","crontab":"","once":false,"x":538.7656211853027,"y":258.00000381469727,"wires":[["b5ab74d6.08edc8"]]},{"id":"38e7a6b0.c484ca","type":"inject","z":"44cc4fb7.965b3","name":"Cooler","topic":"","payload":"cooler","payloadType":"str","repeat":"","crontab":"","once":false,"x":542.2656402587891,"y":303.00001525878906,"wires":[["b5ab74d6.08edc8"]]},{"id":"287ae328.5c945c","type":"inject","z":"44cc4fb7.965b3","name":"Bright Up","topic":"","payload":"bright_up","payloadType":"str","repeat":"","crontab":"","once":false,"x":548.7656555175781,"y":346.00002670288086,"wires":[["b5ab74d6.08edc8"]]},{"id":"268eff9f.0e175","type":"inject","z":"44cc4fb7.965b3","name":"Bright Down","topic":"","payload":"bright_down","payloadType":"str","repeat":"","crontab":"","once":false,"x":557.7656326293945,"y":392.99999809265137,"wires":[["b5ab74d6.08edc8"]]},{"id":"7f19fef2.a20dc","type":"inject","z":"44cc4fb7.965b3","name":"Bright Max","topic":"","payload":"bright_max","payloadType":"str","repeat":"","crontab":"","once":false,"x":547.7656383514404,"y":438.0000286102295,"wires":[["b5ab74d6.08edc8"]]},{"id":"afe72b66.8856e8","type":"inject","z":"44cc4fb7.965b3","name":"Night","topic":"","payload":"night","payloadType":"str","repeat":"","crontab":"","once":false,"x":539.7656536102295,"y":485.00002098083496,"wires":[["b5ab74d6.08edc8"]]},{"id":"1c0123a9.9f827c","type":"inject","z":"44cc4fb7.965b3","name":"Brightness 100%","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"x":568.7656555175781,"y":778.750057220459,"wires":[["e01cd3d0.06b27"]]}] + [{"id":"16adbb3a.8ad3ad","type":"inject","z":"f01695c3.ab1ba","name":"Off","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":531.0000152587891,"y":781.0000228881836,"wires":[["738394f0.59cf84"]]},{"id":"e757aaf3.890c38","type":"inject","z":"f01695c3.ab1ba","name":"On","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":531.0000305175781,"y":835.0000152587891,"wires":[["738394f0.59cf84"]]},{"id":"22cde3fa.effee4","type":"inject","z":"f01695c3.ab1ba","name":"white","topic":"","payload":"white","payloadType":"str","repeat":"","crontab":"","once":false,"x":533,"y":890.9999933242798,"wires":[["738394f0.59cf84"]]},{"id":"b404d6bd.188b08","type":"inject","z":"f01695c3.ab1ba","name":"Brightness 10%","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"x":565,"y":960,"wires":[["8d9398ee.0ee478"]]},{"id":"8d9398ee.0ee478","type":"function","z":"f01695c3.ab1ba","name":"","func":"msg.command = 'brightness';\nreturn msg;","outputs":1,"noerr":0,"x":738.0000228881836,"y":985.0000553131104,"wires":[["738394f0.59cf84"]]},{"id":"75f80511.fbae4c","type":"inject","z":"f01695c3.ab1ba","name":"Color","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"x":533.0000057220459,"y":1071.00004196167,"wires":[["5df96996.a266f8"]]},{"id":"5df96996.a266f8","type":"function","z":"f01695c3.ab1ba","name":"","func":"msg.command = 'color';\nreturn msg;","outputs":1,"noerr":0,"x":735.0000839233398,"y":1073.000057220459,"wires":[["738394f0.59cf84"]]},{"id":"20a9ec26.7dc7f4","type":"inject","z":"f01695c3.ab1ba","name":"On","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":537.0000076293945,"y":396.00000381469727,"wires":[["57f0004d.fff538"]]},{"id":"b7037298.7eb108","type":"inject","z":"f01695c3.ab1ba","name":"Off","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":536.5000133514404,"y":443.00000190734863,"wires":[["57f0004d.fff538"]]},{"id":"a1dd0f97.ba3938","type":"inject","z":"f01695c3.ab1ba","name":"Warmer","topic":"","payload":"warmer","payloadType":"str","repeat":"","crontab":"","once":false,"x":534.9999961853027,"y":486.00000381469727,"wires":[["57f0004d.fff538"]]},{"id":"360fcfc7.32a18","type":"inject","z":"f01695c3.ab1ba","name":"Cooler","topic":"","payload":"cooler","payloadType":"str","repeat":"","crontab":"","once":false,"x":538.5000152587891,"y":531.0000152587891,"wires":[["57f0004d.fff538"]]},{"id":"55b56789.5d9b5","type":"inject","z":"f01695c3.ab1ba","name":"Bright Up","topic":"","payload":"bright_up","payloadType":"str","repeat":"","crontab":"","once":false,"x":545.0000305175781,"y":574.0000267028809,"wires":[["57f0004d.fff538"]]},{"id":"fb1e6779.d598c8","type":"inject","z":"f01695c3.ab1ba","name":"Bright Down","topic":"","payload":"bright_down","payloadType":"str","repeat":"","crontab":"","once":false,"x":554.0000076293945,"y":620.9999980926514,"wires":[["57f0004d.fff538"]]},{"id":"e935e537.f48198","type":"inject","z":"f01695c3.ab1ba","name":"Bright Max","topic":"","payload":"bright_max","payloadType":"str","repeat":"","crontab":"","once":false,"x":544.0000133514404,"y":666.0000286102295,"wires":[["57f0004d.fff538"]]},{"id":"1f2f032a.0d65ad","type":"inject","z":"f01695c3.ab1ba","name":"Night","topic":"","payload":"night","payloadType":"str","repeat":"","crontab":"","once":false,"x":536.0000286102295,"y":713.000020980835,"wires":[["57f0004d.fff538"]]},{"id":"da306d7b.551c2","type":"inject","z":"f01695c3.ab1ba","name":"Brightness 100%","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"x":565.0000305175781,"y":1006.750057220459,"wires":[["8d9398ee.0ee478"]]},{"id":"57f0004d.fff538","type":"milight","z":"f01695c3.ab1ba","name":"White Bulb / Legacy Bridge","bridgetype":"legacy","bulbtype":"white","zone":1,"ip":"255.255.255.255","broadcast":true,"x":998,"y":564,"wires":[]},{"id":"738394f0.59cf84","type":"milight","z":"f01695c3.ab1ba","name":"Color Bulb / Legacy Bridge","bridgetype":"legacy","bulbtype":"rgbw","zone":1,"ip":"255.255.255.255","broadcast":true,"x":1016,"y":887,"wires":[]}] The following bulb types are supported: - WW/CW, aka. "white" @@ -16,14 +16,23 @@ The following bulb types are supported: - RGB WW/CW, aka. "full color" (iBox1/iBox2 bridges) - RGB CW bridge light (iBox1 bridge) -To control the bulb pass the command to `msg.payload` as follows: +To control the bulb pass one of the following commands in `msg.payload`: - 'on' - Turns the bulb on (all bulb types) - 'off' - Turns the bulb off (all bulb types) - 'night' - Turn the night mode (all bulb types) - 'white' - Sets a color bulb to white (color bulb types only) - 'disco' - Cycles a bulb through all the colors (color bulb types, only) - - 'mode' - Cycles through the effect modes (color bulb types only) + - 'modenext' - Cycles through the effect modes (color bulb types only) + - 'candleflicker' - Starts the candle flicker effect mode. (full color bulb only) + - 'rainbowfade' - Starts the rainbow fade effect, which fades between colors. (color bulbs only) + - 'whitefade' - Fades from full on white to off then back again. On full color bulbs fades smoothly between warm and cool white. (color bulbs only) + - 'rgbwfade' - Fades smoothly between colors. (color bulbs only) + - 'rainbow' - Changes the color of the bulb through a sequence of colors. (color bulbs only) + - 'random' - Randomly changes the color of the bulb. (color bulbs only) + - 'redflash' - Fades the bulb from off to full red, then flashes red three times. (color bulbs only) + - 'greenflash' - Fades the bulb from off to full green, then flashes green three times. (color bulbs only) + - 'blueflash' - Fades the bulb from off to full blue, then flashes blue three times. (color bulbs only) - 'speed_up' - Increase the speed of effect mode (color bulb types, only) - 'speed_down' - Decrease the speed of effect mode (color bulb types, only) - 'bright_up' - Increase the brightness of the bulb (white bulb, only) @@ -36,6 +45,7 @@ To control the bulb pass the command to `msg.payload` as follows: - 'brightness' - Set brightness, `msg.payload` must contain a number in 0 - 100 - 'color' - Set color, `msg.payload` must contain a number in 0 - 255 - 'saturation' - Set color saturation (full color bulb type, only), `msg.payload` must contain a number in 0 - 100 + - 'temperature' - Set white color temperature (full color bulb only), `msg.paylod` contains a value between 0 - 100, where 0 is 2700 K and 100 is 6500 K. - *Color String* - If a color string, e.g. "blue" or "rgb(255, 128, 128)" is provided and the command verb "rgb" is assigned to `msg.command` or `msg.topic` the RGB color can be set. Note, however, for "color" and "bridge" type bulbs the Milight hue will be set, only. For "full color" bulbs the saturation and brightness will be also set. diff --git a/MiLight.html b/milight.html similarity index 53% rename from MiLight.html rename to milight.html index e27485e..f6c3444 100644 --- a/MiLight.html +++ b/milight.html @@ -1,9 +1,9 @@ - -