forked from Daniel-t/node-red-contrib-milight
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMiLight.html
More file actions
89 lines (85 loc) · 4.23 KB
/
MiLight.html
File metadata and controls
89 lines (85 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<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"},
broadcast: {value:true}
},
inputs:1,
outputs:0,
icon: "light.png",
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="bridge">Bridge Light (iBox2)</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">
</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>
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>