Repository navigation
Expand file tree
/
Copy pathevent.html
More file actions
104 lines (99 loc) · 4.1 KB
/
Copy pathevent.html
File metadata and controls
104 lines (99 loc) · 4.1 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<script type="text/javascript">
RED.nodes.registerType('matterevent',{
category: 'Matter',
color: '#95cc95',
icon: "font-awesome/fa-bell",
inputs:0,
outputs:1,
defaults: {
name: {value:""},
controller: { value: "", type: "mattercontroller", required: true },
device: {value:"", required:true},
deviceName: {value:""},
endpoint: {value:""},
cluster: {value:"", required:true},
clusterName: {value:""},
event: {value:"", required:true},
simpleMode: {value: "true"},
topic: {value:""}
},
paletteLabel: "Event",
label: function() {
if (this.name) return this.name
if (isRealValue(this.deviceName) && isRealValue(this.event))
return this.deviceName + ' | ' + this.event
return "Event"
},
oneditprepare: function() {
restoreSelect('node-input-device', this.device, this.deviceName)
restoreSelect('node-input-cluster', this.cluster, this.clusterName)
restoreSelect('node-input-event', this.event)
$('#refresh-devices').on("click", getDevices);
$('#refresh-clusters').on("click", getClusters);
$('#refresh-event').on("click", getEvents);
},
oneditsave: function() {
this.deviceName = getSelectedText('node-input-device')
this.clusterName = getSelectedText('node-input-cluster')
}
});
</script>
<script type="text/x-red" data-template-name="matterevent">
<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-controller">Controller</label>
<input type="text" id="node-input-controller" style="width:70%;">
</div>
<div class="form-row">
<label for="node-input-simpleMode">Simple Mode</label>
<input type="checkbox" id="node-input-simpleMode" value="true" >
</div>
<div class="form-row">
<label for="node-input-device">Device</label>
<select type="text" id="node-input-device" style="width:50%;" >
</select>
<a id="refresh-devices" class="btn"><i class="fa fa-refresh"></i></a>
</div>
<!--
<div class="form-row">
<label for="node-input-endpoint">Endpoint</label>
<select type="text" id="node-input-endpoint" style="width:50%;" >
</select>
</div>
-->
<div class="form-row">
<label for="node-input-cluster">Cluster</label>
<select type="text" id="node-input-cluster" style="width:50%;" >
</select>
<a id="refresh-clusters" class="btn"><i class="fa fa-refresh"></i></a>
</div>
<div class="form-row">
<label for="node-input-event">Event</label>
<select type="text" id="node-input-event" style="width:50%;" >
</select>
<a id="refresh-event" class="btn"><i class="fa fa-refresh"></i></a>
</div>
<div class="form-row">
<label for="node-input-topic">Topic</label>
<input type="text" id="node-input-topic">
</div>
</script>
<script type="text/x-red" data-help-name="matterevent">
<p>Receive Events from a Matter Device</p>
<h3>Details</h3>
<p>Events are one-shot notifications emitted by a device cluster when something
discrete happens, such as a button press, a sensor trigger, or a state transition.
Unlike <b>Subscribe</b> (which monitors continuous attribute changes), an Event fires
only when the device explicitly reports it.</p>
<p>Select the device, cluster, and event to listen for. When the event fires, the
node outputs a message with the event data in <code>msg.payload</code>.</p>
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The event data reported by the device</dd>
<dt>topic <span class="property-type">string</span></dt>
<dd>The configured topic string</dd>
</dl>
</script>