UNPKG

node-red-contrib-milight-3

Version:

A Node-RED node to control the MiLight family (limitless led, easybulb) of light.

104 lines (99 loc) 5.14 kB
<script type="text/javascript"> RED.nodes.registerType('MiLight',{ category: 'lights', color: '#FF6600', defaults: { name: {value:"MiLight"}, bridgetype: {value:"legacy"}, bulbtype: {value:"white"}, zone: {value:1,oneditsave:function(){this.zone=parseInt(this.zone)}}, ip: {value:"255.255.255.255"}, ipType: {value:"str"}, broadcast: {value:true} }, inputs:1, outputs:0, icon: "light.png", oneditprepare: () => { $("#node-input-ip").typedInput({ type: "str", types: ["str", "msg", "flow","global"], typeField: "#node-input-ipType" }); }, label: function() { return this.name||"MiLight"; } }); </script> <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"> </div> <div class="form-row"> <label for="node-input-bridgetype"> Bridge Type</label> <select id="node-input-bridgetype"> <option value="legacy" selected="selected">Legacy</option> <option value="v6">iBox1/iBox2 (v6)</option> </select> </div> <div class="form-row"> <label for="node-input-bulbtype"> Bulb Type</label> <select id="node-input-bulbtype"> <option value="white" selected="selected">White</option> <option value="rgbw">Color</option> <option value="fullColor">Full Color (iBox1/iBox2)</option> <option value="fullColor8Zone">Full Color (iBox 8-zone remote)</option> <option value="bridge">Bridge Light (iBox1)</option> </select> </div> <div class="form-row"> <label for="node-input-zone">Zone</label> <input type="text" id="node-input-zone" placeholder="1"> </div> <div class="form-row"> <label for="node-input-ip">IP Address</label> <input type="text" id="node-input-ip" placeholder="255.255.255.255"> <input type="hidden" id="node-input-ipType"> </div> <div class="form-row"> <label for="node-input-broadcast">Broadcast</label> <input type="checkbox" id="node-input-broadcast" placeholder="false" style="display: inline-block; width: auto; vertical-align: top;"> </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> <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><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> <ul> <li>'brightness' - Set brightness, <code>msg.payload</code> must contain a number in 0 - 100</li> <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> <li>'temperature' - Set white color temperature (full color bulb type, only), `msg.payload` 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> 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.</li> <li><i>Mode String</i> - If a mode string, "0x01" to "0x09" is provided and the command verb "mode" is assigned to <code>msg.command</code> or <code>msg.topic</code> the specific mode will be set. (V6 color bulb types only)</li> </ul> </script>