-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathonofflight.html
90 lines (82 loc) · 3.05 KB
/
onofflight.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
<script type="text/javascript">
RED.nodes.registerType('matteronofflight',{
category: 'Matter',
color: '#6699ff',
icon: "font-awesome/fa-lightbulb-o",
inputs:1,
outputs:1,
defaults: {
name: {value:""},
bridge: { value: "", type: "matterbridge", required: true },
passthrough: {value: true},
bat: {value : false},
topic: {}
},
label: function() {
return this.name||"On-Off Light";
},
paletteLabel: "On-Off Light"
});
</script>
<script type="text/x-red" data-template-name="matteronofflight">
<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-config-input-bridge">Bridge</label>
<input type="text" id="node-input-bridge" style="width:70%;">
</div>
<div class="form-row">
<label for="node-input-passthrough">Passthrough Input msg to Output</label>
<select type="text" id="node-input-passthrough" style="width:50%;" >
<option value=true>True</option>
<option value=false>False</option>
</select>
</div>
<div class="form-row">
<label for="node-input-bat">Battery</label>
<select type="text" id="node-input-bat" style="width:50%;" >
<option value=false>None</option>
<option value="recharge">Rechargeable</option>
<option value="replace">Replaceable</option>
</select>
</div>
<div class="form-row">
<label for="node-input-topic">Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic for new msgs">
</div>
</script>
<script type="text/x-red" data-help-name="matteronofflight">
<p>A Bridged On/Off light</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>
payload.state
<span class="property-type">
string | bool | number
</span>
</dt>
<dd>
Control the state of the light, accepts either true/fase, "on/off" or "0/1",<br>
You can also toggle the state by setting the value to "toggle"
</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>
payload.state
<span class="property-type">
bool
</span>
</dt>
<dd>
State of the light, on is true, off is false
</dd>
</dl>
<h3>Details</h3>
Passthrough will control the behaviour of the node in regards to an input,
if set to True then the inout msg wil be output with the new state in the payload.
If set to False then the output will be suppressed.
Where the devices state is updated by an external matter controller a new msg object will always be output.
</script>