forked from sushilks/node-red-contrib-lutron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lutron-status.html
50 lines (48 loc) · 1.76 KB
/
lutron-status.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
<script type="text/javascript">
RED.nodes.registerType('lutron-status', {
category: 'Lutron',
defaults: {
confignode: { value: "", type: "lutron-config" },
name: { value: "" },
},
inputs: 0,
outputs: 1,
color: "#42aeed",
label: function () {
return this.name || "Lutron Status";
},
icon: 'icons/lutron.png',
paletteLabel: "Status",
oneditprepare: function () {
var $DN = $('#node-input-device_name');
var configNode = RED.nodes.node(this.confignode);
// console.log(configNode.deviceMap);
var key = '';
var tsel = '';
for (key in configNode.deviceMap) {
if (this.name == key) {
tsel += '<option selected value"' + key + '">' + key + '</option>';
} else {
tsel += '<option value"' + key + '">' + key + '</option>';
}
}
$('#node-input-device_name').html(tsel);
},
oneditsave: function () {
this.name = $('#node-input-device_name option:selected').text();
}
});
</script>
<script type="text/x-red" data-template-name="lutron-status">
<div class="form-row">
<label for="node-input-confignode"> Lutron Config</label>
<input type="text" id="node-input-confignode">
</div>
<div class="form-row">
<label for="node-input-device_name"><i class="fa fa-tag"></i> Device Name</label>
<select id="node-input-device_name" style="width:200px; font-size: 10px !importnat; height: 24px; padding: 0;">
<option value="foo">foo</option>
<option value="bar">bar</bar>
</select>
</div>
</script>