Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
# 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

```npm i node-red-contrib-milight```

## 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"
- RGB WW, aka. "color"
- 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)
Expand All @@ -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.
Expand Down
49 changes: 30 additions & 19 deletions MiLight.html → milight.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script type="text/javascript">
RED.nodes.registerType('MiLight',{
RED.nodes.registerType('milight',{
category: 'lights',
color: '#FF6600',
defaults: {
name: {value:"MiLight"},
name: {value:"milight"},
bridgetype: {value:"legacy"},
bulbtype: {value:"white"},
zone: {value:1,oneditsave:function(){this.zone=parseInt(this.zone)}},
Expand All @@ -14,12 +14,12 @@
outputs:0,
icon: "light.png",
label: function() {
return this.name||"MiLight";
return this.name||"milight";
}
});
</script>

<script type="text/x-red" data-template-name="MiLight">
<script type="text/x-red" data-template-name="milight">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
Expand Down Expand Up @@ -55,22 +55,31 @@
</div>
</script>

<script type="text/x-red" data-help-name="MiLight">
<p>To control the bulb pass the command to <code>msg.payload</code> as follows:</p>
<script type="text/x-red" data-help-name="milight">
<p>Controls MiLight bulbs and their OEM equivalents. To control the bulb pass one of the following commands to <code>msg.payload</code>:</p>
<ul>
<li>'on' - Turns the bulb on (all bulb types)</li>
<li>'off' - Turns the bulb off (all bulb types)</li>
<li>'night' - Turn the night mode (all bulb types)</li>
<li>'white' - Sets a color bulb to white (color bulb types only)</li>
<li>'disco' - Cycles a bulb through all the colors (color bulb types, only)</li>
<li>'mode' - Cycles through the effect modes (color bulb types only)</li>
<li>'speed_up' - Increase the speed of effect mode (color bulb types, only)</li>
<li>'speed_down' - Decrease the speed of effect mode (color bulb types, only)</li>
<li>'bright_up' - Increase the brightness of the bulb (white bulb, only)</li>
<li>'bright_down' - Decrease the brightness of the bulb (white bulb, only)</li>
<li>'cooler' - Make the bulb cooler (white bulb, only)</li>
<li>'warmer' - Make the bulb warmer (white bulb, only)</li>
<li>'bright_max' - Make the bulb brightness maximum (white bulb, only)</li>
<li>'on' - Turns the bulb on. (all bulb types)</li>
<li>'off' - Turns the bulb off. (all bulb types)</li>
<li>'night' - Turn the night mode. (all bulb types)</li>
<li>'white' - Sets a color bulb to white. (color bulb types only)</li>
<li>'disco' - Cycles a bulb through all the colors. (color bulb types only)</li>
<li>'modenext' - Cycles through the effect modes. (color bulb types only)</li>
<li>'candleflicker' - Starts the candle flicker effect mode. (full color bulb only)</li>
<li>'rainbowfade' - Starts the rainbow fade effect, which fades between colors. (color bulbs only)</li>
<li>'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)</li>
<li>'rgbwfade' - Fades smoothly between colors. (color bulbs only)</li>
<li>'rainbow' - Changes the color of the bulb through a sequence of colors. (color bulbs only)</li>
<li>'random' - Randomly changes the color of the bulb. (color bulbs only)</li>
<li>'redflash' - Fades the bulb from off to full red, then flashes red three times. (color bulbs only)</li>
<li>'greenflash' - Fades the bulb from off to full green, then flashes green three times. (color bulbs only)</li>
<li>'blueflash' - Fades the bulb from off to full blue, then flashes blue three times. (color bulbs only)</li>
<li>'speed_up' - Increase the speed of effect mode. (color bulb types only)</li>
<li>'speed_down' - Decrease the speed of effect mode. (color bulb types only)</li>
<li>'bright_up' - Increase the brightness of the bulb. (white bulb only)</li>
<li>'bright_down' - Decrease the brightness of the bulb. (white bulb only)</li>
<li>'cooler' - Make the bulb cooler. (white bulb only)</li>
<li>'warmer' - Make the bulb warmer. (white bulb only)</li>
<li>'bright_max' - Make the bulb brightness maximum. (white bulb only)</li>
<li><i>Number</i> - If a number is provided the brightness, color, or saturation value of the
color bulb can be controlled by assigning a command verb to <code>msg.command</code>
or <code>msg.topic</code> as follows:</li>
Expand All @@ -79,6 +88,8 @@
<li>'color' - Set color, <code>msg.payload</code> must contain a number in 0 - 255</li>
<li>'saturation' - Set color saturation (full color bulb type, only), <code>msg.payload</code>
must contain a number in 0 - 100</li>
<li>'temperature' - Set white color temperature (full color bulb only), <code>msg.paylod</code> contains
a value between 0 - 100, where 0 is 2700 K and 100 is 6500 K.</li>
</ul>
<li><i>Color String</i> - If a color string, e.g. "blue" or "rgb(255, 128, 128)" is provided and
the command verb "rgb" is assigned to <code>msg.command</code> or <code>msg.topic</code>
Expand Down
Loading