-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenericswitch.html
105 lines (90 loc) · 4.05 KB
/
genericswitch.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
<script type="text/javascript">
RED.nodes.registerType('mattergenericswitch',{
category: 'Matter',
color: '#669999',
icon: "font-awesome/fa-toggle-on",
inputs:1,
outputs:0,
defaults: {
name: {value:""},
bridge: { value: "", type: "matterbridge", required: true },
switchtype: {value: "momentary"},
positions: {value: 2},
multiPressMax: {value: 2},
longPressDelay: {value: 50},
multiPressDelay: {value: 50},
bat: {value : false}
},
label: function() {
return this.name||"Generic Switch";
},
paletteLabel: "Generic Switch"
});
</script>
<script type="text/x-red" data-template-name="mattergenericswitch">
<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-switchtype">Switch Type</label>
<select type="text" id="node-input-switchtype" style="width:50%;" >
<option value=momentary>Momentary Switch</option>
<option value=latched>Latched Switch</option>
</select>
</div>
<div class="form-row">
<label for="node-input-positions">Number of Positions</label>
<input type="text" id="node-input-positions" style="width:70%;">
</div>
<div class="form-row">
<label for="node-input-multiPressMax">Maximum Multiple Presses</label>
<input type="text" id="node-input-multiPressMax" style="width:70%;">
</div>
<div class="form-row">
<label for="node-input-longPressDelay">Long Press Delay (ms)</label>
<input type="text" id="node-input-longPressDelay" style="width:70%;">
</div>
<div class="form-row">
<label for="node-input-multiPressDelay">Multi Press Delay (ms)</label>
<input type="text" id="node-input-multiPressDelay" style="width:70%;">
</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>
</script>
<script type="text/x-red" data-help-name="mattergenericswitch">
<p>A Bridged Generic Momentary Switch (Button)</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>
payload.type
<span class="property-type">
enum
</span>
</dt>
<dd>
<code>single</code> <code>double</code> or <code>long</code> will produce the coresponding events based on the timers set.
Alternativly you can set this to <code>position</code> and then specifiy the position of the switch/button in <code>payload.postion</code>
To create the events manually.
</dd>
</dl>
</dl>
<h3>Details</h3>
As this is a user input device it cannot be updated by the Matter controller and as such has no output only input.
Switch Type allows you to select either a momentary "push button" type of switch or a latching switch that has a number of positions.
Note: that most ecosystems today only support the momntary switch.
Number of Positions is 2 for a momentary or 2 or more for a latching switch
Maximum Multiple Presses applies only to momentary switches, again most ecosystems only support single and double press today
Long Press delay is the time that a momentary switch should remain in the on position for the long press event to be sent.
Multi Press delay is the time between events for a double press event.
</script>