@nr-connect/node-red 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +169 -2
- package/examples/starter-demo.json +776 -0
- package/index.html +1939 -0
- package/index.js +76 -0
- package/lib/binaryManager.js +557 -0
- package/lib/connectionManager.js +1060 -0
- package/lib/connectorManifest.json +61 -0
- package/lib/dashboardRbac.js +670 -0
- package/lib/expressInterceptor.js +917 -0
- package/lib/pageSyncAgent.js +149 -0
- package/lib/pushAgent.js +253 -0
- package/lib/qrCode.js +625 -0
- package/lib/statusEndpoint.js +231 -0
- package/lib/tokenCodec.js +98 -0
- package/lib/tunnelDaemon.js +236 -0
- package/nodes/nr-connect-notify.html +258 -0
- package/nodes/nr-connect-notify.js +303 -0
- package/nodes/ui-nr-connect-profile.html +211 -0
- package/nodes/ui-nr-connect-profile.js +66 -0
- package/package.json +85 -6
- package/resources/ui-nr-connect-profile.umd.js +213 -0
- package/ui/UINrConnectProfile.js +1173 -0
- package/ui/profile.js +1 -0
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "tab_nr_connect_demo",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "NR Connect Dashboard Demo",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Sample FlowFuse Dashboard 2.0 pages for testing @nr-connect/node-red"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "ui_base_demo",
|
|
11
|
+
"type": "ui-base",
|
|
12
|
+
"name": "NR Connect Demo Dashboard",
|
|
13
|
+
"path": "/dashboard",
|
|
14
|
+
"appIcon": "",
|
|
15
|
+
"includeClientData": true,
|
|
16
|
+
"acceptsClientConfig": ["ui-notification", "ui-control"],
|
|
17
|
+
"showPathInSidebar": false,
|
|
18
|
+
"headerContent": "page",
|
|
19
|
+
"navigationStyle": "default",
|
|
20
|
+
"titleBarStyle": "default"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "ui_theme_demo",
|
|
24
|
+
"type": "ui-theme",
|
|
25
|
+
"name": "Default Theme",
|
|
26
|
+
"colors": {
|
|
27
|
+
"surface": "#ffffff",
|
|
28
|
+
"primary": "#0094ce",
|
|
29
|
+
"bgPage": "#eeeeee",
|
|
30
|
+
"groupBg": "#ffffff",
|
|
31
|
+
"groupOutline": "#cccccc"
|
|
32
|
+
},
|
|
33
|
+
"sizes": {
|
|
34
|
+
"density": "default",
|
|
35
|
+
"pagePadding": "12px",
|
|
36
|
+
"groupGap": "12px",
|
|
37
|
+
"groupBorderRadius": "4px",
|
|
38
|
+
"widgetGap": "12px"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "c84a2f10.1a2b3",
|
|
43
|
+
"type": "ui-page",
|
|
44
|
+
"name": "Main Overview",
|
|
45
|
+
"ui": "ui_base_demo",
|
|
46
|
+
"path": "/overview",
|
|
47
|
+
"icon": "home",
|
|
48
|
+
"layout": "grid",
|
|
49
|
+
"theme": "ui_theme_demo",
|
|
50
|
+
"order": 1,
|
|
51
|
+
"className": "",
|
|
52
|
+
"visible": true,
|
|
53
|
+
"disabled": false
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "d95b3e21.4c5d6",
|
|
57
|
+
"type": "ui-page",
|
|
58
|
+
"name": "HVAC & Boilers",
|
|
59
|
+
"ui": "ui_base_demo",
|
|
60
|
+
"path": "/hvac",
|
|
61
|
+
"icon": "thermometer",
|
|
62
|
+
"layout": "grid",
|
|
63
|
+
"theme": "ui_theme_demo",
|
|
64
|
+
"order": 2,
|
|
65
|
+
"className": "",
|
|
66
|
+
"visible": true,
|
|
67
|
+
"disabled": false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "a12c4f32.7e8f9",
|
|
71
|
+
"type": "ui-page",
|
|
72
|
+
"name": "Admin Diagnostics",
|
|
73
|
+
"ui": "ui_base_demo",
|
|
74
|
+
"path": "/diag",
|
|
75
|
+
"icon": "cog",
|
|
76
|
+
"layout": "grid",
|
|
77
|
+
"theme": "ui_theme_demo",
|
|
78
|
+
"order": 3,
|
|
79
|
+
"className": "",
|
|
80
|
+
"visible": true,
|
|
81
|
+
"disabled": false
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "b23d5e43.8f9a0",
|
|
85
|
+
"type": "ui-page",
|
|
86
|
+
"name": "Account",
|
|
87
|
+
"ui": "ui_base_demo",
|
|
88
|
+
"path": "/account",
|
|
89
|
+
"icon": "account",
|
|
90
|
+
"layout": "grid",
|
|
91
|
+
"theme": "ui_theme_demo",
|
|
92
|
+
"order": 4,
|
|
93
|
+
"className": "",
|
|
94
|
+
"visible": true,
|
|
95
|
+
"disabled": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "grp_overview",
|
|
99
|
+
"type": "ui-group",
|
|
100
|
+
"name": "Plant Summary",
|
|
101
|
+
"page": "c84a2f10.1a2b3",
|
|
102
|
+
"width": 6,
|
|
103
|
+
"height": 1,
|
|
104
|
+
"order": 1,
|
|
105
|
+
"showTitle": true,
|
|
106
|
+
"className": "",
|
|
107
|
+
"visible": true,
|
|
108
|
+
"disabled": false
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "grp_hvac",
|
|
112
|
+
"type": "ui-group",
|
|
113
|
+
"name": "Boiler Controls",
|
|
114
|
+
"page": "d95b3e21.4c5d6",
|
|
115
|
+
"width": 6,
|
|
116
|
+
"height": 1,
|
|
117
|
+
"order": 1,
|
|
118
|
+
"showTitle": true,
|
|
119
|
+
"className": "",
|
|
120
|
+
"visible": true,
|
|
121
|
+
"disabled": false
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "grp_diag",
|
|
125
|
+
"type": "ui-group",
|
|
126
|
+
"name": "System Diagnostics",
|
|
127
|
+
"page": "a12c4f32.7e8f9",
|
|
128
|
+
"width": 6,
|
|
129
|
+
"height": 1,
|
|
130
|
+
"order": 1,
|
|
131
|
+
"showTitle": true,
|
|
132
|
+
"className": "",
|
|
133
|
+
"visible": true,
|
|
134
|
+
"disabled": false
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": "grp_account",
|
|
138
|
+
"type": "ui-group",
|
|
139
|
+
"name": "User Profile",
|
|
140
|
+
"page": "b23d5e43.8f9a0",
|
|
141
|
+
"width": 6,
|
|
142
|
+
"height": 1,
|
|
143
|
+
"order": 1,
|
|
144
|
+
"showTitle": true,
|
|
145
|
+
"className": "",
|
|
146
|
+
"visible": true,
|
|
147
|
+
"disabled": false
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "grp_flow_rbac",
|
|
151
|
+
"type": "group",
|
|
152
|
+
"z": "tab_nr_connect_demo",
|
|
153
|
+
"name": "Dashboard & RBAC Demo",
|
|
154
|
+
"style": {
|
|
155
|
+
"stroke": "#4b5563",
|
|
156
|
+
"fill": "#1f2937",
|
|
157
|
+
"fill-opacity": "0.15",
|
|
158
|
+
"label": true,
|
|
159
|
+
"color": "#9ca3af"
|
|
160
|
+
},
|
|
161
|
+
"nodes": [
|
|
162
|
+
"inj_status",
|
|
163
|
+
"ui_txt_overview",
|
|
164
|
+
"ui_btn_hvac",
|
|
165
|
+
"sw_role_gate",
|
|
166
|
+
"dbg_client_user",
|
|
167
|
+
"dbg_role_denied",
|
|
168
|
+
"ui_btn_diag",
|
|
169
|
+
"dbg_diag_user"
|
|
170
|
+
],
|
|
171
|
+
"x": 40,
|
|
172
|
+
"y": 55,
|
|
173
|
+
"w": 960,
|
|
174
|
+
"h": 250
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"id": "grp_flow_push",
|
|
178
|
+
"type": "group",
|
|
179
|
+
"z": "tab_nr_connect_demo",
|
|
180
|
+
"name": "Push Notifications",
|
|
181
|
+
"style": {
|
|
182
|
+
"stroke": "#4b5563",
|
|
183
|
+
"fill": "#1f2937",
|
|
184
|
+
"fill-opacity": "0.15",
|
|
185
|
+
"label": true,
|
|
186
|
+
"color": "#9ca3af"
|
|
187
|
+
},
|
|
188
|
+
"nodes": [
|
|
189
|
+
"ui_btn_test_push",
|
|
190
|
+
"nr_notify_hvac",
|
|
191
|
+
"inj_notify_page_access",
|
|
192
|
+
"nr_notify_page_access",
|
|
193
|
+
"inj_notify_admins",
|
|
194
|
+
"nr_notify_admins",
|
|
195
|
+
"inj_notify_emails",
|
|
196
|
+
"nr_notify_emails",
|
|
197
|
+
"inj_notify_dynamic",
|
|
198
|
+
"fn_notify_override",
|
|
199
|
+
"nr_notify_dynamic",
|
|
200
|
+
"jnc_push_results",
|
|
201
|
+
"dbg_push_result"
|
|
202
|
+
],
|
|
203
|
+
"x": 40,
|
|
204
|
+
"y": 415,
|
|
205
|
+
"w": 1200,
|
|
206
|
+
"h": 415
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"id": "grp_flow_profile",
|
|
210
|
+
"type": "group",
|
|
211
|
+
"z": "tab_nr_connect_demo",
|
|
212
|
+
"name": "Profile Widgets",
|
|
213
|
+
"style": {
|
|
214
|
+
"stroke": "#4b5563",
|
|
215
|
+
"fill": "#1f2937",
|
|
216
|
+
"fill-opacity": "0.15",
|
|
217
|
+
"label": true,
|
|
218
|
+
"color": "#9ca3af"
|
|
219
|
+
},
|
|
220
|
+
"nodes": [
|
|
221
|
+
"ui_profile_appbar",
|
|
222
|
+
"ui_profile_card"
|
|
223
|
+
],
|
|
224
|
+
"x": 40,
|
|
225
|
+
"y": 860,
|
|
226
|
+
"w": 500,
|
|
227
|
+
"h": 140
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "grp_flow_webhook",
|
|
231
|
+
"type": "group",
|
|
232
|
+
"z": "tab_nr_connect_demo",
|
|
233
|
+
"name": "Public Sensor Webhook",
|
|
234
|
+
"style": {
|
|
235
|
+
"stroke": "#4b5563",
|
|
236
|
+
"fill": "#1f2937",
|
|
237
|
+
"fill-opacity": "0.15",
|
|
238
|
+
"label": true,
|
|
239
|
+
"color": "#9ca3af"
|
|
240
|
+
},
|
|
241
|
+
"nodes": [
|
|
242
|
+
"wh_sensor_in",
|
|
243
|
+
"wh_sensor_validate",
|
|
244
|
+
"wh_sensor_res",
|
|
245
|
+
"wh_sensor_log"
|
|
246
|
+
],
|
|
247
|
+
"x": 40,
|
|
248
|
+
"y": 1030,
|
|
249
|
+
"w": 840,
|
|
250
|
+
"h": 140
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"id": "inj_status",
|
|
254
|
+
"type": "inject",
|
|
255
|
+
"z": "tab_nr_connect_demo",
|
|
256
|
+
"g": "grp_flow_rbac",
|
|
257
|
+
"name": "System Online",
|
|
258
|
+
"props": [{ "p": "payload" }],
|
|
259
|
+
"repeat": "",
|
|
260
|
+
"crontab": "",
|
|
261
|
+
"once": true,
|
|
262
|
+
"onceDelay": 0.5,
|
|
263
|
+
"topic": "",
|
|
264
|
+
"payload": "All zones nominal",
|
|
265
|
+
"payloadType": "str",
|
|
266
|
+
"x": 160,
|
|
267
|
+
"y": 100,
|
|
268
|
+
"wires": [["ui_txt_overview"]]
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "ui_txt_overview",
|
|
272
|
+
"type": "ui-text",
|
|
273
|
+
"z": "tab_nr_connect_demo",
|
|
274
|
+
"g": "grp_flow_rbac",
|
|
275
|
+
"group": "grp_overview",
|
|
276
|
+
"order": 1,
|
|
277
|
+
"width": 0,
|
|
278
|
+
"height": 0,
|
|
279
|
+
"name": "Status Text",
|
|
280
|
+
"label": "Facility Status",
|
|
281
|
+
"format": "{{msg.payload}}",
|
|
282
|
+
"layout": "row-spread",
|
|
283
|
+
"style": false,
|
|
284
|
+
"font": "",
|
|
285
|
+
"fontSize": 16,
|
|
286
|
+
"color": "#71717a",
|
|
287
|
+
"className": "",
|
|
288
|
+
"x": 480,
|
|
289
|
+
"y": 100,
|
|
290
|
+
"wires": []
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"id": "ui_btn_hvac",
|
|
294
|
+
"type": "ui-button",
|
|
295
|
+
"z": "tab_nr_connect_demo",
|
|
296
|
+
"g": "grp_flow_rbac",
|
|
297
|
+
"group": "grp_hvac",
|
|
298
|
+
"name": "Toggle Boiler Pump",
|
|
299
|
+
"label": "Toggle Boiler Pump",
|
|
300
|
+
"order": 1,
|
|
301
|
+
"width": 0,
|
|
302
|
+
"height": 0,
|
|
303
|
+
"emulateClick": false,
|
|
304
|
+
"tooltip": "",
|
|
305
|
+
"color": "",
|
|
306
|
+
"bgcolor": "",
|
|
307
|
+
"className": "",
|
|
308
|
+
"icon": "",
|
|
309
|
+
"iconPosition": "left",
|
|
310
|
+
"payload": "toggle_pump",
|
|
311
|
+
"payloadType": "str",
|
|
312
|
+
"topic": "hvac/pump",
|
|
313
|
+
"topicType": "str",
|
|
314
|
+
"buttonColor": "",
|
|
315
|
+
"textColor": "",
|
|
316
|
+
"iconColor": "",
|
|
317
|
+
"x": 160,
|
|
318
|
+
"y": 180,
|
|
319
|
+
"wires": [["sw_role_gate"]]
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"id": "sw_role_gate",
|
|
323
|
+
"type": "switch",
|
|
324
|
+
"z": "tab_nr_connect_demo",
|
|
325
|
+
"g": "grp_flow_rbac",
|
|
326
|
+
"name": "Gate by msg._client.user.role",
|
|
327
|
+
"property": "_client.user.role",
|
|
328
|
+
"propertyType": "msg",
|
|
329
|
+
"rules": [
|
|
330
|
+
{ "t": "eq", "v": "admin", "vt": "str" },
|
|
331
|
+
{ "t": "eq", "v": "operator", "vt": "str" },
|
|
332
|
+
{ "t": "else" }
|
|
333
|
+
],
|
|
334
|
+
"checkall": "true",
|
|
335
|
+
"repair": false,
|
|
336
|
+
"outputs": 3,
|
|
337
|
+
"x": 480,
|
|
338
|
+
"y": 180,
|
|
339
|
+
"wires": [
|
|
340
|
+
["dbg_client_user"],
|
|
341
|
+
["dbg_client_user"],
|
|
342
|
+
["dbg_role_denied"]
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"id": "dbg_client_user",
|
|
347
|
+
"type": "debug",
|
|
348
|
+
"z": "tab_nr_connect_demo",
|
|
349
|
+
"g": "grp_flow_rbac",
|
|
350
|
+
"name": "Allowed: inspect msg._client.user",
|
|
351
|
+
"active": true,
|
|
352
|
+
"tosidebar": true,
|
|
353
|
+
"console": true,
|
|
354
|
+
"tostatus": false,
|
|
355
|
+
"complete": "true",
|
|
356
|
+
"targetType": "full",
|
|
357
|
+
"statusVal": "",
|
|
358
|
+
"statusType": "auto",
|
|
359
|
+
"x": 840,
|
|
360
|
+
"y": 140,
|
|
361
|
+
"wires": []
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"id": "dbg_role_denied",
|
|
365
|
+
"type": "debug",
|
|
366
|
+
"z": "tab_nr_connect_demo",
|
|
367
|
+
"g": "grp_flow_rbac",
|
|
368
|
+
"name": "Denied: requires admin/operator",
|
|
369
|
+
"active": true,
|
|
370
|
+
"tosidebar": true,
|
|
371
|
+
"console": true,
|
|
372
|
+
"tostatus": false,
|
|
373
|
+
"complete": "true",
|
|
374
|
+
"targetType": "full",
|
|
375
|
+
"statusVal": "",
|
|
376
|
+
"statusType": "auto",
|
|
377
|
+
"x": 840,
|
|
378
|
+
"y": 200,
|
|
379
|
+
"wires": []
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"id": "ui_btn_diag",
|
|
383
|
+
"type": "ui-button",
|
|
384
|
+
"z": "tab_nr_connect_demo",
|
|
385
|
+
"g": "grp_flow_rbac",
|
|
386
|
+
"group": "grp_diag",
|
|
387
|
+
"name": "Restart Edge Agent",
|
|
388
|
+
"label": "Restart Edge Agent",
|
|
389
|
+
"order": 1,
|
|
390
|
+
"width": 0,
|
|
391
|
+
"height": 0,
|
|
392
|
+
"emulateClick": false,
|
|
393
|
+
"tooltip": "",
|
|
394
|
+
"color": "",
|
|
395
|
+
"bgcolor": "",
|
|
396
|
+
"className": "",
|
|
397
|
+
"icon": "",
|
|
398
|
+
"iconPosition": "left",
|
|
399
|
+
"payload": "restart_diag",
|
|
400
|
+
"payloadType": "str",
|
|
401
|
+
"topic": "diag/restart",
|
|
402
|
+
"topicType": "str",
|
|
403
|
+
"buttonColor": "",
|
|
404
|
+
"textColor": "",
|
|
405
|
+
"iconColor": "",
|
|
406
|
+
"x": 160,
|
|
407
|
+
"y": 260,
|
|
408
|
+
"wires": [["dbg_diag_user"]]
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"id": "dbg_diag_user",
|
|
412
|
+
"type": "debug",
|
|
413
|
+
"z": "tab_nr_connect_demo",
|
|
414
|
+
"g": "grp_flow_rbac",
|
|
415
|
+
"name": "Inspect diag msg._client.user",
|
|
416
|
+
"active": true,
|
|
417
|
+
"tosidebar": true,
|
|
418
|
+
"console": true,
|
|
419
|
+
"tostatus": false,
|
|
420
|
+
"complete": "true",
|
|
421
|
+
"targetType": "full",
|
|
422
|
+
"statusVal": "",
|
|
423
|
+
"statusType": "auto",
|
|
424
|
+
"x": 480,
|
|
425
|
+
"y": 260,
|
|
426
|
+
"wires": []
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"id": "ui_btn_test_push",
|
|
430
|
+
"type": "ui-button",
|
|
431
|
+
"z": "tab_nr_connect_demo",
|
|
432
|
+
"g": "grp_flow_push",
|
|
433
|
+
"group": "grp_hvac",
|
|
434
|
+
"name": "Send HVAC Push Alert",
|
|
435
|
+
"label": "Send HVAC Push Alert",
|
|
436
|
+
"order": 2,
|
|
437
|
+
"width": 0,
|
|
438
|
+
"height": 0,
|
|
439
|
+
"emulateClick": false,
|
|
440
|
+
"tooltip": "",
|
|
441
|
+
"color": "",
|
|
442
|
+
"bgcolor": "",
|
|
443
|
+
"className": "",
|
|
444
|
+
"icon": "",
|
|
445
|
+
"iconPosition": "left",
|
|
446
|
+
"payload": "Boiler pressure threshold exceeded",
|
|
447
|
+
"payloadType": "str",
|
|
448
|
+
"topic": "hvac/alarm",
|
|
449
|
+
"topicType": "str",
|
|
450
|
+
"buttonColor": "",
|
|
451
|
+
"textColor": "",
|
|
452
|
+
"iconColor": "",
|
|
453
|
+
"x": 160,
|
|
454
|
+
"y": 460,
|
|
455
|
+
"wires": [["nr_notify_hvac"]]
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"id": "nr_notify_hvac",
|
|
459
|
+
"type": "nr-connect-notify",
|
|
460
|
+
"z": "tab_nr_connect_demo",
|
|
461
|
+
"g": "grp_flow_push",
|
|
462
|
+
"name": "Notify HVAC Operators",
|
|
463
|
+
"title": "HVAC Alert",
|
|
464
|
+
"titleType": "str",
|
|
465
|
+
"body": "payload",
|
|
466
|
+
"bodyType": "msg",
|
|
467
|
+
"pageId": "d95b3e21.4c5d6",
|
|
468
|
+
"target": "all",
|
|
469
|
+
"emails": "",
|
|
470
|
+
"url": "",
|
|
471
|
+
"tag": "hvac-alarm",
|
|
472
|
+
"urgency": "high",
|
|
473
|
+
"requireInteraction": false,
|
|
474
|
+
"x": 480,
|
|
475
|
+
"y": 460,
|
|
476
|
+
"wires": [["jnc_push_results"]]
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"id": "inj_notify_page_access",
|
|
480
|
+
"type": "inject",
|
|
481
|
+
"z": "tab_nr_connect_demo",
|
|
482
|
+
"g": "grp_flow_push",
|
|
483
|
+
"name": "Notify HVAC Page Users",
|
|
484
|
+
"props": [{ "p": "payload" }],
|
|
485
|
+
"repeat": "",
|
|
486
|
+
"crontab": "",
|
|
487
|
+
"once": false,
|
|
488
|
+
"onceDelay": 0.1,
|
|
489
|
+
"topic": "hvac/maintenance",
|
|
490
|
+
"payload": "Scheduled boiler filter check at 14:00",
|
|
491
|
+
"payloadType": "str",
|
|
492
|
+
"x": 160,
|
|
493
|
+
"y": 540,
|
|
494
|
+
"wires": [["nr_notify_page_access"]]
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"id": "nr_notify_page_access",
|
|
498
|
+
"type": "nr-connect-notify",
|
|
499
|
+
"z": "tab_nr_connect_demo",
|
|
500
|
+
"g": "grp_flow_push",
|
|
501
|
+
"name": "Notify Page Access (HVAC)",
|
|
502
|
+
"title": "HVAC Maintenance",
|
|
503
|
+
"titleType": "str",
|
|
504
|
+
"body": "payload",
|
|
505
|
+
"bodyType": "msg",
|
|
506
|
+
"pageId": "d95b3e21.4c5d6",
|
|
507
|
+
"target": "all",
|
|
508
|
+
"emails": "",
|
|
509
|
+
"url": "",
|
|
510
|
+
"tag": "hvac-maintenance",
|
|
511
|
+
"urgency": "normal",
|
|
512
|
+
"requireInteraction": false,
|
|
513
|
+
"x": 480,
|
|
514
|
+
"y": 540,
|
|
515
|
+
"wires": [["jnc_push_results"]]
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"id": "inj_notify_admins",
|
|
519
|
+
"type": "inject",
|
|
520
|
+
"z": "tab_nr_connect_demo",
|
|
521
|
+
"g": "grp_flow_push",
|
|
522
|
+
"name": "Notify Admins Only",
|
|
523
|
+
"props": [{ "p": "payload" }],
|
|
524
|
+
"repeat": "",
|
|
525
|
+
"crontab": "",
|
|
526
|
+
"once": false,
|
|
527
|
+
"onceDelay": 0.1,
|
|
528
|
+
"topic": "diag/admin",
|
|
529
|
+
"payload": "Edge controller firmware update available",
|
|
530
|
+
"payloadType": "str",
|
|
531
|
+
"x": 160,
|
|
532
|
+
"y": 620,
|
|
533
|
+
"wires": [["nr_notify_admins"]]
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"id": "nr_notify_admins",
|
|
537
|
+
"type": "nr-connect-notify",
|
|
538
|
+
"z": "tab_nr_connect_demo",
|
|
539
|
+
"g": "grp_flow_push",
|
|
540
|
+
"name": "Notify Admins",
|
|
541
|
+
"title": "Admin Notice",
|
|
542
|
+
"titleType": "str",
|
|
543
|
+
"body": "payload",
|
|
544
|
+
"bodyType": "msg",
|
|
545
|
+
"pageId": "a12c4f32.7e8f9",
|
|
546
|
+
"target": "admins",
|
|
547
|
+
"emails": "",
|
|
548
|
+
"url": "",
|
|
549
|
+
"tag": "admin-notice",
|
|
550
|
+
"urgency": "normal",
|
|
551
|
+
"requireInteraction": false,
|
|
552
|
+
"x": 480,
|
|
553
|
+
"y": 620,
|
|
554
|
+
"wires": [["jnc_push_results"]]
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"id": "inj_notify_emails",
|
|
558
|
+
"type": "inject",
|
|
559
|
+
"z": "tab_nr_connect_demo",
|
|
560
|
+
"g": "grp_flow_push",
|
|
561
|
+
"name": "Notify Specific Emails",
|
|
562
|
+
"props": [{ "p": "payload" }],
|
|
563
|
+
"repeat": "",
|
|
564
|
+
"crontab": "",
|
|
565
|
+
"once": false,
|
|
566
|
+
"onceDelay": 0.1,
|
|
567
|
+
"topic": "ops/direct",
|
|
568
|
+
"payload": "Direct alert for named operators",
|
|
569
|
+
"payloadType": "str",
|
|
570
|
+
"x": 160,
|
|
571
|
+
"y": 700,
|
|
572
|
+
"wires": [["nr_notify_emails"]]
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"id": "nr_notify_emails",
|
|
576
|
+
"type": "nr-connect-notify",
|
|
577
|
+
"z": "tab_nr_connect_demo",
|
|
578
|
+
"g": "grp_flow_push",
|
|
579
|
+
"name": "Notify Emails",
|
|
580
|
+
"title": "Direct Operator Alert",
|
|
581
|
+
"titleType": "str",
|
|
582
|
+
"body": "payload",
|
|
583
|
+
"bodyType": "msg",
|
|
584
|
+
"pageId": "",
|
|
585
|
+
"target": "emails",
|
|
586
|
+
"emails": "operator@example.com, admin@example.com",
|
|
587
|
+
"url": "",
|
|
588
|
+
"tag": "direct-alert",
|
|
589
|
+
"urgency": "normal",
|
|
590
|
+
"requireInteraction": false,
|
|
591
|
+
"x": 480,
|
|
592
|
+
"y": 700,
|
|
593
|
+
"wires": [["jnc_push_results"]]
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"id": "inj_notify_dynamic",
|
|
597
|
+
"type": "inject",
|
|
598
|
+
"z": "tab_nr_connect_demo",
|
|
599
|
+
"g": "grp_flow_push",
|
|
600
|
+
"name": "Trigger Dynamic Override",
|
|
601
|
+
"props": [{ "p": "payload" }],
|
|
602
|
+
"repeat": "",
|
|
603
|
+
"crontab": "",
|
|
604
|
+
"once": false,
|
|
605
|
+
"onceDelay": 0.1,
|
|
606
|
+
"topic": "hvac/dynamic",
|
|
607
|
+
"payload": "Zone 2 pressure spike",
|
|
608
|
+
"payloadType": "str",
|
|
609
|
+
"x": 160,
|
|
610
|
+
"y": 780,
|
|
611
|
+
"wires": [["fn_notify_override"]]
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"id": "fn_notify_override",
|
|
615
|
+
"type": "function",
|
|
616
|
+
"z": "tab_nr_connect_demo",
|
|
617
|
+
"g": "grp_flow_push",
|
|
618
|
+
"name": "Build msg.notification & msg.recipients",
|
|
619
|
+
"func": "msg.notification = {\n title: \"Dynamic Boiler Alert\",\n body: msg.payload,\n pageId: \"d95b3e21.4c5d6\",\n urgency: \"high\",\n requireInteraction: true\n};\nmsg.recipients = [\"operator@example.com\"];\nreturn msg;",
|
|
620
|
+
"outputs": 1,
|
|
621
|
+
"timeout": 0,
|
|
622
|
+
"noerr": 0,
|
|
623
|
+
"initialize": "",
|
|
624
|
+
"finalize": "",
|
|
625
|
+
"libs": [],
|
|
626
|
+
"x": 480,
|
|
627
|
+
"y": 780,
|
|
628
|
+
"wires": [["nr_notify_dynamic"]]
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"id": "nr_notify_dynamic",
|
|
632
|
+
"type": "nr-connect-notify",
|
|
633
|
+
"z": "tab_nr_connect_demo",
|
|
634
|
+
"g": "grp_flow_push",
|
|
635
|
+
"name": "Notify Dynamic Override",
|
|
636
|
+
"title": "Fallback Title",
|
|
637
|
+
"titleType": "str",
|
|
638
|
+
"body": "payload",
|
|
639
|
+
"bodyType": "msg",
|
|
640
|
+
"pageId": "",
|
|
641
|
+
"target": "all",
|
|
642
|
+
"emails": "",
|
|
643
|
+
"url": "",
|
|
644
|
+
"tag": "dynamic-alert",
|
|
645
|
+
"urgency": "normal",
|
|
646
|
+
"requireInteraction": false,
|
|
647
|
+
"x": 840,
|
|
648
|
+
"y": 780,
|
|
649
|
+
"wires": [["dbg_push_result"]]
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"id": "jnc_push_results",
|
|
653
|
+
"type": "junction",
|
|
654
|
+
"z": "tab_nr_connect_demo",
|
|
655
|
+
"g": "grp_flow_push",
|
|
656
|
+
"x": 840,
|
|
657
|
+
"y": 580,
|
|
658
|
+
"wires": [["dbg_push_result"]]
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"id": "dbg_push_result",
|
|
662
|
+
"type": "debug",
|
|
663
|
+
"z": "tab_nr_connect_demo",
|
|
664
|
+
"g": "grp_flow_push",
|
|
665
|
+
"name": "Inspect push result",
|
|
666
|
+
"active": true,
|
|
667
|
+
"tosidebar": true,
|
|
668
|
+
"console": true,
|
|
669
|
+
"tostatus": false,
|
|
670
|
+
"complete": "true",
|
|
671
|
+
"targetType": "full",
|
|
672
|
+
"statusVal": "",
|
|
673
|
+
"statusType": "auto",
|
|
674
|
+
"x": 1120,
|
|
675
|
+
"y": 580,
|
|
676
|
+
"wires": []
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"id": "ui_profile_appbar",
|
|
680
|
+
"type": "ui-nr-connect-profile",
|
|
681
|
+
"z": "tab_nr_connect_demo",
|
|
682
|
+
"g": "grp_flow_profile",
|
|
683
|
+
"name": "Profile (app bar)",
|
|
684
|
+
"placement": "appbar",
|
|
685
|
+
"ui": "ui_base_demo",
|
|
686
|
+
"group": "",
|
|
687
|
+
"order": 0,
|
|
688
|
+
"width": 0,
|
|
689
|
+
"height": 0,
|
|
690
|
+
"showEmail": true,
|
|
691
|
+
"showRole": true,
|
|
692
|
+
"showSignOut": true,
|
|
693
|
+
"x": 160,
|
|
694
|
+
"y": 905,
|
|
695
|
+
"wires": []
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"id": "ui_profile_card",
|
|
699
|
+
"type": "ui-nr-connect-profile",
|
|
700
|
+
"z": "tab_nr_connect_demo",
|
|
701
|
+
"g": "grp_flow_profile",
|
|
702
|
+
"name": "Profile (card)",
|
|
703
|
+
"placement": "group",
|
|
704
|
+
"ui": "",
|
|
705
|
+
"group": "grp_account",
|
|
706
|
+
"order": 1,
|
|
707
|
+
"width": 0,
|
|
708
|
+
"height": 0,
|
|
709
|
+
"showEmail": true,
|
|
710
|
+
"showRole": true,
|
|
711
|
+
"showSignOut": true,
|
|
712
|
+
"x": 160,
|
|
713
|
+
"y": 965,
|
|
714
|
+
"wires": []
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
"id": "wh_sensor_in",
|
|
718
|
+
"type": "http in",
|
|
719
|
+
"z": "tab_nr_connect_demo",
|
|
720
|
+
"g": "grp_flow_webhook",
|
|
721
|
+
"name": "POST /webhook/sensor",
|
|
722
|
+
"url": "/webhook/sensor",
|
|
723
|
+
"method": "post",
|
|
724
|
+
"upload": false,
|
|
725
|
+
"x": 180,
|
|
726
|
+
"y": 1100,
|
|
727
|
+
"wires": [["wh_sensor_validate"]]
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"id": "wh_sensor_validate",
|
|
731
|
+
"type": "function",
|
|
732
|
+
"z": "tab_nr_connect_demo",
|
|
733
|
+
"g": "grp_flow_webhook",
|
|
734
|
+
"name": "Validate payload",
|
|
735
|
+
"func": "const { deviceId, value } = msg.payload || {};\n\nif (!deviceId || typeof value !== \"number\") {\n msg.statusCode = 400;\n msg.payload = { ok: false, error: \"Expected { deviceId, value }\" };\n return [msg, null];\n}\n\nmsg.statusCode = 200;\nconst reading = { deviceId, value, receivedAt: new Date().toISOString() };\nmsg.payload = { ok: true, receivedAt: reading.receivedAt };\nreturn [msg, { payload: reading }];",
|
|
736
|
+
"outputs": 2,
|
|
737
|
+
"timeout": 0,
|
|
738
|
+
"noerr": 0,
|
|
739
|
+
"initialize": "",
|
|
740
|
+
"finalize": "",
|
|
741
|
+
"libs": [],
|
|
742
|
+
"x": 450,
|
|
743
|
+
"y": 1100,
|
|
744
|
+
"wires": [["wh_sensor_res"], ["wh_sensor_log"]]
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"id": "wh_sensor_res",
|
|
748
|
+
"type": "http response",
|
|
749
|
+
"z": "tab_nr_connect_demo",
|
|
750
|
+
"g": "grp_flow_webhook",
|
|
751
|
+
"name": "JSON response",
|
|
752
|
+
"statusCode": "",
|
|
753
|
+
"headers": { "content-type": "application/json" },
|
|
754
|
+
"x": 730,
|
|
755
|
+
"y": 1075,
|
|
756
|
+
"wires": []
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"id": "wh_sensor_log",
|
|
760
|
+
"type": "debug",
|
|
761
|
+
"z": "tab_nr_connect_demo",
|
|
762
|
+
"g": "grp_flow_webhook",
|
|
763
|
+
"name": "Ingested reading",
|
|
764
|
+
"active": true,
|
|
765
|
+
"tosidebar": true,
|
|
766
|
+
"console": false,
|
|
767
|
+
"tostatus": false,
|
|
768
|
+
"complete": "payload",
|
|
769
|
+
"targetType": "msg",
|
|
770
|
+
"statusVal": "",
|
|
771
|
+
"statusType": "auto",
|
|
772
|
+
"x": 740,
|
|
773
|
+
"y": 1130,
|
|
774
|
+
"wires": []
|
|
775
|
+
}
|
|
776
|
+
]
|