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
143 changes: 56 additions & 87 deletions MiLight.html
Original file line number Diff line number Diff line change
@@ -1,120 +1,89 @@
<script type="text/javascript">
RED.nodes.registerType('MiLightRGB',{
category: 'output',
color: '#a6bbcf',
RED.nodes.registerType('MiLight',{
category: 'lights',
color: '#FF6600',
defaults: {
name: {value:"MiLight RGB"},
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"},
broadcast: {value:true}
},
inputs:1,
outputs:0,
icon: "file.png",
icon: "light.png",
label: function() {
return this.name||"MiLight RGB";
}
});
RED.nodes.registerType('MiLightWhite',{
category: 'output',
color: '#a6bbcf',
defaults: {
name: {value:"MiLight White"},
zone: {value:1,oneditsave:function(){this.zone=parseInt(this.zone)}},
ip: {value:"255.255.255.255"},
broadcast: {value:true}

},
inputs:1,
outputs:0,
icon: "file.png",
label: function() {
return this.name||"MiLight White";
}
});
RED.nodes.registerType('MiLightPower',{
category: 'output',
color: '#a6bbcf',
defaults: {
name: {value:"MiLight Power"},
zone: {value:1,oneditsave:function(){this.zone=parseInt(this.zone)}},
ip: {value:"255.255.255.255"},
broadcast: {value:true}

},
inputs:1,
outputs:0,
icon: "file.png",
label: function() {
return this.name||"MiLight Power";
return this.name||"MiLight";
}
});
</script>

<script type="text/x-red" data-template-name="MiLightRGB">
<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-zone"><i class="icon-tag"></i>Default Zone</label>
<input type="text" id="node-input-zone" placeholder="1">
</div>
<div class="form-row">
<label for="node-input-ip"><i class="icon-tag"></i>IP Address</label>
<input type="text" id="node-input-ip" placeholder="255.255.255.255">
<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-broadcast"><i class="icon-tag"></i>Broadcast</label>
<input type="checkbox" id="node-input-broadcast" placeholder="false">
<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="bridge">Bridge Light (iBox2)</option>
</select>
</div>
</script>

<script type="text/x-red" data-help-name="MiLightRGB">
<p>Sets a MiLight globe to the RGB (#000000) value specified in msg.payload</p>
</script>

<script type="text/x-red" data-template-name="MiLightPower">
<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-zone"><i class="icon-tag"></i>Default Zone</label>
<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"><i class="icon-tag"></i>IP Address</label>
<label for="node-input-ip">IP Address</label>
<input type="text" id="node-input-ip" placeholder="255.255.255.255">
</div>
<div class="form-row">
<label for="node-input-broadcast"><i class="icon-tag"></i>Broadcast</label>
<input type="checkbox" id="node-input-broadcast" placeholder="false">
<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="MiLightPower">
<p>Sets a MiLight power status to either on/off based on msg.payload (expects "on" or "off" only). "On" will return to last used configuration</p>
</script>
<script type="text/x-red" data-template-name="MiLightWhite">
<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-zone"><i class="icon-tag"></i>Default Zone</label>
<input type="text" id="node-input-zone" placeholder="1">
</div>
<div class="form-row">
<label for="node-input-ip"><i class="icon-tag"></i>IP Address</label>
<input type="text" id="node-input-ip" placeholder="255.255.255.255">
</div>
<div class="form-row">
<label for="node-input-broadcast"><i class="icon-tag"></i>Broadcast</label>
<input type="checkbox" id="node-input-broadcast" placeholder="false">
</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>
must contain a number in 0 - 100</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>
</ul>

<script type="text/x-red" data-help-name="MiLightWhite">
<p>Sets a MiLight globe to white to a brightness value specified in msg.payload (1-100)</p>
</script>
</script>
Loading