-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtunable-white.html
122 lines (119 loc) · 6.6 KB
/
tunable-white.html
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<script type="text/javascript">
RED.nodes.registerType('tunable-white', {
category: 'homesmart',
color: '#94c1d0',
defaults: {
url: { value: "", required: true },
key: { value: "", required: true },
dataPoint1Hour: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 23))) }},
dataPoint1CT: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 153) && (v <= 500))) }},
dataPoint2Hour: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 23))) }},
dataPoint2CT: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 153) && (v <= 500))) }},
dataPoint3Hour: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 23))) }},
dataPoint3CT: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 153) && (v <= 500))) }},
CTMax: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 153) && (v <= 500))) }},
CTMin: { value: "", required: false, validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 153) && (v <= 500))) }}
},
inputs: 1,
outputs: 1,
icon: "light.svg",
label: function () {
return this.name || "tunable white"
}
})
</script>
<script type="text/html" data-template-name="tunable-white">
<div class="form-row">
<label for="node-input-url"><i class="fa fa-globe"></i> URL of controller</label>
<input type="text" id="node-input-url" placeholder="Eg. 192.168.0.45">
</div>
<div class="form-row">
<label for="node-input-key"><i class="fa fa-key"></i> API key (username)</label>
<input type="text" id="node-input-key" placeholder="Eg. Xyewrasd324235tgh34213xSGR">
</div>
<div class="form-tips">
<span><b>Tip:</b> To get an API key follow Philips' <a target="_blank" href="https://developers.meethue.com/develop/get-started-2/">official guide to getting the API key</a> (aka. *username*)</span>
</div>
<div class="form-row">
<span><b>Advanced optional settings.</b></span>
</div>
<div class="form-row">
<div style="margin-top: 10px; width: 500px;">
Define a hour of the day as a whole number and a color temperature for that hour.
Hour = 0-23 and/or color temperature(CT) = 153-500. CT 400=orange/night lighting and 200=blueish/midday lightning.
</div>
<div style="margin-top: 0px; width: 500px;">
<i>Some bulbs have a reduced actual level of change of CT values. ct value of=190-454 seems to give the right light tones on multible bulbs compared and is therfore recommended as a min/max value.</i>
</div>
</div>
<div class="form-row">
<label>Data point 1</label>
<span>hour</span>: <input type="number" id="node-input-dataPoint1Hour" style="width:100px;" autocomplete="off" placeholder="7 (7 am)">
<span>CT</span>: <input type="number" id="node-input-dataPoint1CT" style="width:100px;" autocomplete="off" placeholder="400">
</div>
<div class="form-row">
<label>Data point 2</label>
<span>hour</span>: <input type="number" id="node-input-dataPoint2Hour" style="width:100px;" autocomplete="off" placeholder="14 (2 pm)">
<span>CT</span>: <input type="number" id="node-input-dataPoint2CT" style="width:100px;" autocomplete="off" placeholder="200">
</div>
<div class="form-row">
<label>Data point 3</label>
<span>hour</span>: <input type="number" id="node-input-dataPoint3Hour" style="width:100px;" autocomplete="off" placeholder="21 (9 pm)">
<span>CT</span>: <input type="number" id="node-input-dataPoint3CT" style="width:100px;" autocomplete="off" placeholder="400">
</div>
<div class="form-row">
<label>Color temperature limits</label>
<span>min</span>: <input type="number" id="node-input-CTMin" style="width:100px;" autocomplete="off" placeholder="195">
<span>max</span>: <input type="number" id="node-input-CTMax" style="width:100px;" autocomplete="off" placeholder="410">
</div>
</script>
<script type="text/html" data-help-name="tunable-white">
<p>Automatically calculates the correct color temperature as the day progress and send updates to the Hue Bridge to update all lights. Manually changed lights wont be affected by this node.</p>
<p>Accepts any input to make it run.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>reset
<span class="property-type">boolean</span>
</dt>
<dd>
<code>true</code> will force all lights to update now no matter their current color. Its a good practice to run this once a day.
</dd>
<dt>newColor
<span class="property-type">number (154-500)</span>
</dt>
<dd>
Request a specific <code>ct</code> value. This will obey the the max and min ct settings define in node advance setting.
</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>newColor
<span class="property-type">number (154-500)</span>
</dt>
<dd>
The new color temperature sent to the lights. For more info see Philips Hue API calls about <code>ct</code> value.
</dd>
<dt>payload.lightChanged
<span class="property-type">array</span>
</dt>
<dd>
Array of reachable lights that was changed in color. (All reachable light is changed at first run).
</dd>
<dt>payload.lightNotChanged
<span class="property-type">array</span>
</dt>
<dd>
Array of reachable lights that was not changed in color, possible because they had been manually changed to another color then the default one. <i>Unreachable/offline lights are not listed here.</i>
</dd>
<dt>time
<span class="property-type">string</span>
</dt>
<dd>
Server time in 24h format, as seen by node-red. If wrong update timezone of installation.
</dd>
</dl>
</script>