-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmeshtastic-msg.html
373 lines (342 loc) · 16.6 KB
/
meshtastic-msg.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<script type="text/javascript">
//-----------------------------------------------------------------------------
//Send text messages node
RED.nodes.registerType('meshtastic-msg-send',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
},
inputs: 1,
outputs: 0,
icon: "Mesh_Logo_White.svg",
paletteLabel: "send text",
label: function() {
return this.name||"msh send text";
},
});
//-----------------------------------------------------------------------------
//Receive text messages node
RED.nodes.registerType('meshtastic-msg-receive',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
},
inputs: 0,
outputs: 1,
icon: "Mesh_Logo_White.svg",
paletteLabel: "receive text",
label: function() {
return this.name||"msh receive text";
}
});
//-----------------------------------------------------------------------------
//Device status node
RED.nodes.registerType('meshtastic-msg-status',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
},
inputs: 0,
outputs: 1,
icon: "Mesh_Logo_White.svg",
paletteLabel: "receive status",
label: function() {
return this.name||"msh receive status";
}
});
//-----------------------------------------------------------------------------
//Receive generic event node
RED.nodes.registerType('meshtastic-msg-receiveevent',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
event: {value:"onDeviceStatus",required: true},
},
inputs: 0,
outputs: 1,
icon: "Mesh_Logo_White.svg",
paletteLabel: "receive event",
label: function() {
return this.name||"msh receive event";
},
oneditprepare: function (optionsList) {
$("#node-input-event").typedInput({
types: [
{
value: "event",
options: //Someday I need to populate this automatically
[
{ value: "onChannelPacket", label: "onChannelPacket"},
{ value: "onConfigPacket", label: "onConfigPacket"},
{ value: "onDetectionSensorPacket", label: "onDetectionSensorPacket"},
{ value: "onDeviceDebugLog", label: "onDeviceDebugLog"},
{ value: "onDeviceStatus", label: "onDeviceStatus"},
{ value: "onFromRadio", label: "onFromRadio"},
{ value: "onIpTunnelPacket", label: "onIpTunnelPacket"},
{ value: "onLogEvent", label: "onLogEvent"},
{ value: "onLogRecord", label: "onLogRecord"},
{ value: "onMapReportPacket", label: "onMapReportPacket"},
{ value: "onMeshHeartbeat", label: "onMeshHeartbeat"},
{ value: "onMeshPacket", label: "onMeshPacket"},
{ value: "onMessagePacket", label: "onMessagePacket"},
{ value: "onModuleConfigPacket", label: "onModuleConfigPacket"},
{ value: "onMyNodeInfo", label: "onMyNodeInfo"},
{ value: "onNeighborInfoPacket", label: "onNeighborInfoPacket"},
{ value: "onNodeInfoPacket", label: "onNodeInfoPacket"},
{ value: "onPaxcounterPacket", label: "onPaxcounterPacket"},
{ value: "onPendingSettingsChange", label: "onPendingSettingsChange"},
{ value: "onPingPacket", label: "onPingPacket"},
{ value: "onPositionPacket", label: "onPositionPacket"},
{ value: "onPrivatePacket", label: "onPrivatePacket"},
{ value: "onQueueStatus", label: "onQueueStatus"},
{ value: "onRangeTestPacket", label: "onRangeTestPacket"},
{ value: "onRemoteHardwarePacket", label: "onRemoteHardwarePacket"},
{ value: "onRoutingPacket", label: "onRoutingPacket"},
{ value: "onSerialPacket", label: "onSerialPacket"},
{ value: "onSimulatorPacket", label: "onSimulatorPacket"},
{ value: "onStoreForwardPacket", label: "onStoreForwardPacket"},
{ value: "onTelemetryPacket", label: "onTelemetryPacket"},
{ value: "onTraceRoutePacket", label: "onTraceRoutePacket"},
{ value: "onUserPacket", label: "onUserPacket"},
{ value: "onWaypointPacket", label: "onWaypointPacket"},
{ value: "onZpsPacket", label: "onZpsPacket"}
]
}
]
});
},
});
//-----------------------------------------------------------------------------
//Send generic packet node
RED.nodes.registerType('meshtastic-msg-sendpacket',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
},
inputs: 1,
outputs: 0,
icon: "Mesh_Logo_White.svg",
paletteLabel: "send packet",
label: function() {
return this.name||"msh send packet";
},
});
//-----------------------------------------------------------------------------
//Receive Meshtastic.js log node
RED.nodes.registerType('meshtastic-msg-log',{
category: 'Meshtastic',
color: '#67ea94',
defaults: {
name: {value:""},
device: {value:"", type:"meshtastic-msg-device"},
},
inputs: 0,
outputs: 1,
icon: "Mesh_Logo_White.svg",
paletteLabel: "log",
label: function() {
return this.name||"msh log";
},
});
//-----------------------------------------------------------------------------
//Meshtastic device configuration node
RED.nodes.registerType('meshtastic-msg-device',{
category: 'config',
defaults: {
fetch_interval: {value:5000, required: true},
tls: {value:false, required: true},
ip_address: {value:"meshtastic.local",required: true}
},
label: function() {
return this.ip_address;
},
oneditprepare: function () {
$("#node-config-input-ip_address").typedInput({
type:"str",
types:["str"]
});
$("#node-config-input-tls").typedInput({
type:"bool",
types:["bool"]
});
$("#node-config-input-fetch_interval").typedInput({
type:"num",
types:["num"]
});
},
});
</script>
<!------------------------------------------------------------------------------------------->
<!-- Send text messages node -->
<script type="text/html" data-template-name="meshtastic-msg-send">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive text messages node -->
<script type="text/html" data-template-name="meshtastic-msg-receive">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive status node -->
<script type="text/html" data-template-name="meshtastic-msg-status">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive generic event -->
<script type="text/html" data-template-name="meshtastic-msg-receiveevent">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
<div class="form-row">
<label for="node-input-event"><i class="fa fa-tag"></i> Event</label>
<input type="text" id="node-input-event" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Send packet -->
<script type="text/html" data-template-name="meshtastic-msg-sendpacket">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive Meshtastic.js log node -->
<script type="text/html" data-template-name="meshtastic-msg-log">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-device"><i class="fa fa-tag"></i> Meshtastic device</label>
<input type="text" id="node-input-device" placeholder="">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Meshtastic device configuration node -->
<script type="text/html" data-template-name="meshtastic-msg-device">
<div class="form-row">
<label for="node-config-input-ip_address"><i class="fa fa-tag"></i> IP or hostname</label>
<input type="text" id="node-config-input-ip_address" placeholder="meshtastic.local">
</div>
<div class="form-row">
<label for="node-config-input-tls"><i class="fa fa-tag"></i> Use TLS</label>
<input type="text" id="node-config-input-tls">
</div>
<div class="form-row">
<label for="node-config-input-fetch_interval"><i class="fa fa-tag"></i> Fetch interval (ms)</label>
<input type="text" id="node-config-input-fetch_interval" placeholder="5000">
</div>
</script>
<!------------------------------------------------------------------------------------------->
<!-- Send text message node -->
<script type="text/markdown" data-help-name="meshtastic-msg-send">
Send a text message to the mesh connected device
### Input
: msg.payload (string) : the text message to be sent to the network
: *msg.channel* (integer): the Meshtastic channel number. Defaults to 0 (primary)
: *msg.destination* (integer): the destination node number, *broadcast* or *self*. Defaults to *broadcast*
: *msg.wantAck* (boolean): if the receiving devices should acknowldege receipt. Defaults to *true*
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive text message node -->
<script type="text/markdown" data-help-name="meshtastic-msg-receive">
Receive a text message from the mesh connected device
### Outputs
: msg (json) : object with all package properties
: msg.payload (string): text content of the message
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive status node -->
<script type="text/markdown" data-help-name="meshtastic-msg-status">
Receive the status code of the Meshtastic device
### Outputs
: msg.payload (integer): status code of the device
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive generic event node -->
<script type="text/markdown" data-help-name="meshtastic-msg-receiveevent">
This node will watch for the defined event and output the payload received.
Typically, the output should be a JSON field but there are some events that report numbers or simple strings.
The events list comes from [Mesthastic.js Event System Class](https://js.meshtastic.org/classes/Utils.EventSystem.html)
### Settings
: event (string): select the event to monitor/watch
### Outputs
: msg (json): data from the event
</script>
<!------------------------------------------------------------------------------------------->
<!-- Send generic packet node -->
<script type="text/markdown" data-help-name="meshtastic-msg-sendpacket">
Send a packet to the mesh connected device.
Input packet can be either in the string format (*msg.payload*) or Uint8Array (*msg.byteData*) format.
### Input
: msgpayload (string): Will be converted to Uint8Array and used if *byteData* field is not set
: *msg.byteData* (json) : Data properly encoded as Uint8Array. If set, will be used instead of *payload*. Example [72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33]
: *msg.portNum* (integer): Application number. Defaults to 1 (text messsage app)
: *msg.destination* (integer string): Destination node number, *broadcast* or *self*. Detaults to *broadcast*
: *msg.channel* (integer): Channel number, defaults to *0* (primary)
: *msg.wantAck* (boolean): Confirmation, defaults to *true*
: *msg.wantResponse* (boolean): Defaults to *false*
: *msg.echoResponse* (boolean): Defaults to *false*
: *msg.replyId* (integer): Defaults to *null*
: *msg.emoji* (integer): Defaults to *null*
</script>
<!------------------------------------------------------------------------------------------->
<!-- Receive Meshtastic.js log node -->
<script type="text/markdown" data-help-name="meshtastic-msg-log">
Output the log from [Mesthastic.js](https://js.meshtastic.org) library. Usefull for debug purposes and connection status info.
**Note:** This is not Node-RED log neither the Lora device log.
### Outputs
: msg (json) : object with all log message properties
: msg.payload (string): text content of the log entry (fields \[0\] and \[1\] concatenated)
</script>
<!------------------------------------------------------------------------------------------->
<!-- Meshtastic device configuration node -->
<script type="text/markdown" data-help-name="meshtastic-msg-device">
This will setup the connection to the Meshtastic node.
The connection protocol is HTTP. Serial, Bluetooth or MQTT are not supported.
### Options
* IP or hostname (string) : IP address or hostname of the Meshtastic device to connect. Examples: *192.168.0.15*, *meshtastic.local*
* Use TLS (boolean): If true, the connection will be performed using TLS (encrypted). Default is false as most of the devices are not configured for it.
* Fetch interval (integer): Interval between polling data from the device. Default is 5000ms.
</script>