|
@@ -0,0 +1,848 @@
|
|
1
|
+title: Node-RED
|
|
2
|
+description: Point 'n' Click workflow automation
|
|
3
|
+parent: smarthome
|
|
4
|
+position: 300
|
|
5
|
+date: 2021-11-01
|
|
6
|
+update: 2022-05-21
|
|
7
|
+---
|
|
8
|
+
|
|
9
|
+[Node-RED](https://nodered.org/) is a great tool for visually creating workflows based on events.
|
|
10
|
+I use it in conjunction with my [ESP-Env sensor and actor hardware](espenv.html) and MQTT to automate my *smart* home.
|
|
11
|
+
|
|
12
|
+I plan to extend these workflows as required when I add new hardware to my network.
|
|
13
|
+
|
|
14
|
+Here is a simple setup that automatically switches lights in my bathroom according to the sun position, using [node-red-contrib-sunevents](https://github.com/freakent/node-red-contrib-sunevents).
|
|
15
|
+
|
|
16
|
+The fan in my window-less bathroom is kept on all the time for now.
|
|
17
|
+In the future I want to add movement sensors to the bathroom and integrate them into this logic, as well as the temperature / humidity sensors I already have in there.
|
|
18
|
+All these devices run my [ESP-Env](/espenv.html) firmware.
|
|
19
|
+
|
|
20
|
+<!--%
|
|
21
|
+lightgallery([
|
|
22
|
+ [ "img/nodered_lights.png", "Switching the lights" ],
|
|
23
|
+ [ "img/nodered_fan.png", "Keeping fan always on" ],
|
|
24
|
+ [ "img/nodered_mqtt.png", "Helper function for MQTT" ],
|
|
25
|
+])
|
|
26
|
+%-->
|
|
27
|
+
|
|
28
|
+And here are the flows for importing in Node-RED.
|
|
29
|
+<button type="button" onclick="copyEvent('jsonlights')" style="font-size: 1em; margin-left: 1em;">Copy to clipboard</button>
|
|
30
|
+
|
|
31
|
+<!-- https://clay-atlas.com/us/blog/2021/06/30/html-en-copy-text-button/ -->
|
|
32
|
+<script>
|
|
33
|
+function copyEvent(id) {
|
|
34
|
+ var str = document.getElementById(id);
|
|
35
|
+ window.getSelection().selectAllChildren(str);
|
|
36
|
+ document.execCommand("Copy")
|
|
37
|
+}
|
|
38
|
+</script>
|
|
39
|
+
|
|
40
|
+<pre id="jsonlights">
|
|
41
|
+[
|
|
42
|
+ {
|
|
43
|
+ "id": "490116e54af5ff9a",
|
|
44
|
+ "type": "tab",
|
|
45
|
+ "label": "Bathroom Lights",
|
|
46
|
+ "disabled": false,
|
|
47
|
+ "info": "",
|
|
48
|
+ "env": []
|
|
49
|
+ },
|
|
50
|
+ {
|
|
51
|
+ "id": "74341bea93cc320d",
|
|
52
|
+ "type": "tab",
|
|
53
|
+ "label": "Bathroom Fan",
|
|
54
|
+ "disabled": false,
|
|
55
|
+ "info": "",
|
|
56
|
+ "env": []
|
|
57
|
+ },
|
|
58
|
+ {
|
|
59
|
+ "id": "b9932c4c66b18537",
|
|
60
|
+ "type": "tab",
|
|
61
|
+ "label": "Functions",
|
|
62
|
+ "disabled": false,
|
|
63
|
+ "info": "",
|
|
64
|
+ "env": []
|
|
65
|
+ },
|
|
66
|
+ {
|
|
67
|
+ "id": "5be146a97e98891c",
|
|
68
|
+ "type": "mqtt-broker",
|
|
69
|
+ "name": "iot.fritz.box",
|
|
70
|
+ "broker": "iot.fritz.box",
|
|
71
|
+ "port": "1883",
|
|
72
|
+ "clientid": "",
|
|
73
|
+ "autoConnect": true,
|
|
74
|
+ "usetls": false,
|
|
75
|
+ "protocolVersion": "5",
|
|
76
|
+ "keepalive": "60",
|
|
77
|
+ "cleansession": true,
|
|
78
|
+ "birthTopic": "",
|
|
79
|
+ "birthQos": "0",
|
|
80
|
+ "birthPayload": "",
|
|
81
|
+ "birthMsg": {},
|
|
82
|
+ "closeTopic": "",
|
|
83
|
+ "closeQos": "0",
|
|
84
|
+ "closePayload": "",
|
|
85
|
+ "closeMsg": {},
|
|
86
|
+ "willTopic": "",
|
|
87
|
+ "willQos": "0",
|
|
88
|
+ "willPayload": "",
|
|
89
|
+ "willMsg": {},
|
|
90
|
+ "sessionExpiry": ""
|
|
91
|
+ },
|
|
92
|
+ {
|
|
93
|
+ "id": "4039bc1ca3cd6e11",
|
|
94
|
+ "type": "comment",
|
|
95
|
+ "z": "490116e54af5ff9a",
|
|
96
|
+ "name": "Check for new Sun Events",
|
|
97
|
+ "info": "",
|
|
98
|
+ "x": 150,
|
|
99
|
+ "y": 160,
|
|
100
|
+ "wires": []
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ "id": "ce5504b6991f8bf4",
|
|
104
|
+ "type": "inject",
|
|
105
|
+ "z": "490116e54af5ff9a",
|
|
106
|
+ "name": "Every 12h",
|
|
107
|
+ "props": [
|
|
108
|
+ {
|
|
109
|
+ "p": "topic",
|
|
110
|
+ "vt": "str"
|
|
111
|
+ }
|
|
112
|
+ ],
|
|
113
|
+ "repeat": "43200",
|
|
114
|
+ "crontab": "",
|
|
115
|
+ "once": true,
|
|
116
|
+ "onceDelay": "1",
|
|
117
|
+ "topic": "",
|
|
118
|
+ "x": 110,
|
|
119
|
+ "y": 200,
|
|
120
|
+ "wires": [
|
|
121
|
+ [
|
|
122
|
+ "5151002c9539d2d6"
|
|
123
|
+ ]
|
|
124
|
+ ]
|
|
125
|
+ },
|
|
126
|
+ {
|
|
127
|
+ "id": "5151002c9539d2d6",
|
|
128
|
+ "type": "change",
|
|
129
|
+ "z": "490116e54af5ff9a",
|
|
130
|
+ "name": "Set Location",
|
|
131
|
+ "rules": [
|
|
132
|
+ {
|
|
133
|
+ "t": "set",
|
|
134
|
+ "p": "payload.latitude",
|
|
135
|
+ "pt": "msg",
|
|
136
|
+ "to": "47.6",
|
|
137
|
+ "tot": "str"
|
|
138
|
+ },
|
|
139
|
+ {
|
|
140
|
+ "t": "set",
|
|
141
|
+ "p": "payload.longitude",
|
|
142
|
+ "pt": "msg",
|
|
143
|
+ "to": "9.4",
|
|
144
|
+ "tot": "str"
|
|
145
|
+ }
|
|
146
|
+ ],
|
|
147
|
+ "action": "",
|
|
148
|
+ "property": "",
|
|
149
|
+ "from": "",
|
|
150
|
+ "to": "",
|
|
151
|
+ "reg": false,
|
|
152
|
+ "x": 270,
|
|
153
|
+ "y": 200,
|
|
154
|
+ "wires": [
|
|
155
|
+ [
|
|
156
|
+ "bc6e8bf098875279"
|
|
157
|
+ ]
|
|
158
|
+ ]
|
|
159
|
+ },
|
|
160
|
+ {
|
|
161
|
+ "id": "bc6e8bf098875279",
|
|
162
|
+ "type": "sun events",
|
|
163
|
+ "z": "490116e54af5ff9a",
|
|
164
|
+ "testmode": false,
|
|
165
|
+ "verbose": "N",
|
|
166
|
+ "topic": "",
|
|
167
|
+ "name": "Sun Events",
|
|
168
|
+ "x": 430,
|
|
169
|
+ "y": 200,
|
|
170
|
+ "wires": [
|
|
171
|
+ [
|
|
172
|
+ "4384fcd3b3567c6c",
|
|
173
|
+ "9c21e093193d54e4"
|
|
174
|
+ ]
|
|
175
|
+ ]
|
|
176
|
+ },
|
|
177
|
+ {
|
|
178
|
+ "id": "d8f1896d6ed5ca0d",
|
|
179
|
+ "type": "switch",
|
|
180
|
+ "z": "490116e54af5ff9a",
|
|
181
|
+ "name": "On Sunrise",
|
|
182
|
+ "property": "sunevent",
|
|
183
|
+ "propertyType": "global",
|
|
184
|
+ "rules": [
|
|
185
|
+ {
|
|
186
|
+ "t": "eq",
|
|
187
|
+ "v": "sunrise",
|
|
188
|
+ "vt": "str"
|
|
189
|
+ }
|
|
190
|
+ ],
|
|
191
|
+ "checkall": "false",
|
|
192
|
+ "repair": false,
|
|
193
|
+ "outputs": 1,
|
|
194
|
+ "x": 350,
|
|
195
|
+ "y": 360,
|
|
196
|
+ "wires": [
|
|
197
|
+ [
|
|
198
|
+ "98d848700eaa119d",
|
|
199
|
+ "76965df29f0c2651"
|
|
200
|
+ ]
|
|
201
|
+ ]
|
|
202
|
+ },
|
|
203
|
+ {
|
|
204
|
+ "id": "d17e0c1b295d531a",
|
|
205
|
+ "type": "switch",
|
|
206
|
+ "z": "490116e54af5ff9a",
|
|
207
|
+ "name": "On Sunset",
|
|
208
|
+ "property": "sunevent",
|
|
209
|
+ "propertyType": "global",
|
|
210
|
+ "rules": [
|
|
211
|
+ {
|
|
212
|
+ "t": "eq",
|
|
213
|
+ "v": "sunset",
|
|
214
|
+ "vt": "str"
|
|
215
|
+ }
|
|
216
|
+ ],
|
|
217
|
+ "checkall": "false",
|
|
218
|
+ "repair": false,
|
|
219
|
+ "outputs": 1,
|
|
220
|
+ "x": 350,
|
|
221
|
+ "y": 480,
|
|
222
|
+ "wires": [
|
|
223
|
+ [
|
|
224
|
+ "3e4a16697db5b83d",
|
|
225
|
+ "6df166fb14211461"
|
|
226
|
+ ]
|
|
227
|
+ ]
|
|
228
|
+ },
|
|
229
|
+ {
|
|
230
|
+ "id": "895f005abb0c7a30",
|
|
231
|
+ "type": "change",
|
|
232
|
+ "z": "490116e54af5ff9a",
|
|
233
|
+ "name": "Bathroom Big Light",
|
|
234
|
+ "rules": [
|
|
235
|
+ {
|
|
236
|
+ "t": "set",
|
|
237
|
+ "p": "topic",
|
|
238
|
+ "pt": "msg",
|
|
239
|
+ "to": "bathroom/light_big",
|
|
240
|
+ "tot": "str"
|
|
241
|
+ }
|
|
242
|
+ ],
|
|
243
|
+ "action": "",
|
|
244
|
+ "property": "",
|
|
245
|
+ "from": "",
|
|
246
|
+ "to": "",
|
|
247
|
+ "reg": false,
|
|
248
|
+ "x": 690,
|
|
249
|
+ "y": 340,
|
|
250
|
+ "wires": [
|
|
251
|
+ [
|
|
252
|
+ "c8246e3ed2f6ac51"
|
|
253
|
+ ]
|
|
254
|
+ ]
|
|
255
|
+ },
|
|
256
|
+ {
|
|
257
|
+ "id": "c8246e3ed2f6ac51",
|
|
258
|
+ "type": "link call",
|
|
259
|
+ "z": "490116e54af5ff9a",
|
|
260
|
+ "name": "",
|
|
261
|
+ "links": [
|
|
262
|
+ "fd3c7a7a7a3b2e99"
|
|
263
|
+ ],
|
|
264
|
+ "timeout": "30",
|
|
265
|
+ "x": 960,
|
|
266
|
+ "y": 420,
|
|
267
|
+ "wires": [
|
|
268
|
+ []
|
|
269
|
+ ]
|
|
270
|
+ },
|
|
271
|
+ {
|
|
272
|
+ "id": "bbd4b1ede10ea09e",
|
|
273
|
+ "type": "change",
|
|
274
|
+ "z": "490116e54af5ff9a",
|
|
275
|
+ "name": "Bathroom Small Light",
|
|
276
|
+ "rules": [
|
|
277
|
+ {
|
|
278
|
+ "t": "set",
|
|
279
|
+ "p": "topic",
|
|
280
|
+ "pt": "msg",
|
|
281
|
+ "to": "bathroom/light_small",
|
|
282
|
+ "tot": "str"
|
|
283
|
+ }
|
|
284
|
+ ],
|
|
285
|
+ "action": "",
|
|
286
|
+ "property": "",
|
|
287
|
+ "from": "",
|
|
288
|
+ "to": "",
|
|
289
|
+ "reg": false,
|
|
290
|
+ "x": 700,
|
|
291
|
+ "y": 460,
|
|
292
|
+ "wires": [
|
|
293
|
+ [
|
|
294
|
+ "c8246e3ed2f6ac51"
|
|
295
|
+ ]
|
|
296
|
+ ]
|
|
297
|
+ },
|
|
298
|
+ {
|
|
299
|
+ "id": "0516f39aac309884",
|
|
300
|
+ "type": "change",
|
|
301
|
+ "z": "490116e54af5ff9a",
|
|
302
|
+ "name": "Store Sun State",
|
|
303
|
+ "rules": [
|
|
304
|
+ {
|
|
305
|
+ "t": "set",
|
|
306
|
+ "p": "sunevent",
|
|
307
|
+ "pt": "global",
|
|
308
|
+ "to": "payload.sunevent",
|
|
309
|
+ "tot": "msg"
|
|
310
|
+ }
|
|
311
|
+ ],
|
|
312
|
+ "action": "",
|
|
313
|
+ "property": "",
|
|
314
|
+ "from": "",
|
|
315
|
+ "to": "",
|
|
316
|
+ "reg": false,
|
|
317
|
+ "x": 800,
|
|
318
|
+ "y": 200,
|
|
319
|
+ "wires": [
|
|
320
|
+ [
|
|
321
|
+ "23bd87871e2f0ecb"
|
|
322
|
+ ]
|
|
323
|
+ ]
|
|
324
|
+ },
|
|
325
|
+ {
|
|
326
|
+ "id": "86248602292b2932",
|
|
327
|
+ "type": "inject",
|
|
328
|
+ "z": "490116e54af5ff9a",
|
|
329
|
+ "name": "Every 30sec",
|
|
330
|
+ "props": [
|
|
331
|
+ {
|
|
332
|
+ "p": "payload"
|
|
333
|
+ },
|
|
334
|
+ {
|
|
335
|
+ "p": "topic",
|
|
336
|
+ "vt": "str"
|
|
337
|
+ }
|
|
338
|
+ ],
|
|
339
|
+ "repeat": "30",
|
|
340
|
+ "crontab": "",
|
|
341
|
+ "once": true,
|
|
342
|
+ "onceDelay": "5",
|
|
343
|
+ "topic": "",
|
|
344
|
+ "payloadType": "date",
|
|
345
|
+ "x": 120,
|
|
346
|
+ "y": 360,
|
|
347
|
+ "wires": [
|
|
348
|
+ [
|
|
349
|
+ "d8f1896d6ed5ca0d",
|
|
350
|
+ "d17e0c1b295d531a"
|
|
351
|
+ ]
|
|
352
|
+ ]
|
|
353
|
+ },
|
|
354
|
+ {
|
|
355
|
+ "id": "98d848700eaa119d",
|
|
356
|
+ "type": "change",
|
|
357
|
+ "z": "490116e54af5ff9a",
|
|
358
|
+ "name": "Turn On",
|
|
359
|
+ "rules": [
|
|
360
|
+ {
|
|
361
|
+ "t": "set",
|
|
362
|
+ "p": "payload",
|
|
363
|
+ "pt": "msg",
|
|
364
|
+ "to": "on",
|
|
365
|
+ "tot": "str"
|
|
366
|
+ }
|
|
367
|
+ ],
|
|
368
|
+ "action": "",
|
|
369
|
+ "property": "",
|
|
370
|
+ "from": "",
|
|
371
|
+ "to": "",
|
|
372
|
+ "reg": false,
|
|
373
|
+ "x": 520,
|
|
374
|
+ "y": 340,
|
|
375
|
+ "wires": [
|
|
376
|
+ [
|
|
377
|
+ "895f005abb0c7a30"
|
|
378
|
+ ]
|
|
379
|
+ ]
|
|
380
|
+ },
|
|
381
|
+ {
|
|
382
|
+ "id": "76965df29f0c2651",
|
|
383
|
+ "type": "change",
|
|
384
|
+ "z": "490116e54af5ff9a",
|
|
385
|
+ "name": "Turn Off",
|
|
386
|
+ "rules": [
|
|
387
|
+ {
|
|
388
|
+ "t": "set",
|
|
389
|
+ "p": "payload",
|
|
390
|
+ "pt": "msg",
|
|
391
|
+ "to": "off",
|
|
392
|
+ "tot": "str"
|
|
393
|
+ }
|
|
394
|
+ ],
|
|
395
|
+ "action": "",
|
|
396
|
+ "property": "",
|
|
397
|
+ "from": "",
|
|
398
|
+ "to": "",
|
|
399
|
+ "reg": false,
|
|
400
|
+ "x": 520,
|
|
401
|
+ "y": 380,
|
|
402
|
+ "wires": [
|
|
403
|
+ [
|
|
404
|
+ "b7ea8636c374cd25"
|
|
405
|
+ ]
|
|
406
|
+ ]
|
|
407
|
+ },
|
|
408
|
+ {
|
|
409
|
+ "id": "b7ea8636c374cd25",
|
|
410
|
+ "type": "change",
|
|
411
|
+ "z": "490116e54af5ff9a",
|
|
412
|
+ "name": "Bathroom Small Light",
|
|
413
|
+ "rules": [
|
|
414
|
+ {
|
|
415
|
+ "t": "set",
|
|
416
|
+ "p": "topic",
|
|
417
|
+ "pt": "msg",
|
|
418
|
+ "to": "bathroom/light_small",
|
|
419
|
+ "tot": "str"
|
|
420
|
+ }
|
|
421
|
+ ],
|
|
422
|
+ "action": "",
|
|
423
|
+ "property": "",
|
|
424
|
+ "from": "",
|
|
425
|
+ "to": "",
|
|
426
|
+ "reg": false,
|
|
427
|
+ "x": 700,
|
|
428
|
+ "y": 380,
|
|
429
|
+ "wires": [
|
|
430
|
+ [
|
|
431
|
+ "c8246e3ed2f6ac51"
|
|
432
|
+ ]
|
|
433
|
+ ]
|
|
434
|
+ },
|
|
435
|
+ {
|
|
436
|
+ "id": "3e4a16697db5b83d",
|
|
437
|
+ "type": "change",
|
|
438
|
+ "z": "490116e54af5ff9a",
|
|
439
|
+ "name": "Turn On",
|
|
440
|
+ "rules": [
|
|
441
|
+ {
|
|
442
|
+ "t": "set",
|
|
443
|
+ "p": "payload",
|
|
444
|
+ "pt": "msg",
|
|
445
|
+ "to": "on",
|
|
446
|
+ "tot": "str"
|
|
447
|
+ }
|
|
448
|
+ ],
|
|
449
|
+ "action": "",
|
|
450
|
+ "property": "",
|
|
451
|
+ "from": "",
|
|
452
|
+ "to": "",
|
|
453
|
+ "reg": false,
|
|
454
|
+ "x": 520,
|
|
455
|
+ "y": 460,
|
|
456
|
+ "wires": [
|
|
457
|
+ [
|
|
458
|
+ "bbd4b1ede10ea09e"
|
|
459
|
+ ]
|
|
460
|
+ ]
|
|
461
|
+ },
|
|
462
|
+ {
|
|
463
|
+ "id": "6df166fb14211461",
|
|
464
|
+ "type": "change",
|
|
465
|
+ "z": "490116e54af5ff9a",
|
|
466
|
+ "name": "Turn Off",
|
|
467
|
+ "rules": [
|
|
468
|
+ {
|
|
469
|
+ "t": "set",
|
|
470
|
+ "p": "payload",
|
|
471
|
+ "pt": "msg",
|
|
472
|
+ "to": "off",
|
|
473
|
+ "tot": "str"
|
|
474
|
+ }
|
|
475
|
+ ],
|
|
476
|
+ "action": "",
|
|
477
|
+ "property": "",
|
|
478
|
+ "from": "",
|
|
479
|
+ "to": "",
|
|
480
|
+ "reg": false,
|
|
481
|
+ "x": 520,
|
|
482
|
+ "y": 500,
|
|
483
|
+ "wires": [
|
|
484
|
+ [
|
|
485
|
+ "8c16ac287cbf877c"
|
|
486
|
+ ]
|
|
487
|
+ ]
|
|
488
|
+ },
|
|
489
|
+ {
|
|
490
|
+ "id": "8c16ac287cbf877c",
|
|
491
|
+ "type": "change",
|
|
492
|
+ "z": "490116e54af5ff9a",
|
|
493
|
+ "name": "Bathroom Big Light",
|
|
494
|
+ "rules": [
|
|
495
|
+ {
|
|
496
|
+ "t": "set",
|
|
497
|
+ "p": "topic",
|
|
498
|
+ "pt": "msg",
|
|
499
|
+ "to": "bathroom/light_big",
|
|
500
|
+ "tot": "str"
|
|
501
|
+ }
|
|
502
|
+ ],
|
|
503
|
+ "action": "",
|
|
504
|
+ "property": "",
|
|
505
|
+ "from": "",
|
|
506
|
+ "to": "",
|
|
507
|
+ "reg": false,
|
|
508
|
+ "x": 690,
|
|
509
|
+ "y": 500,
|
|
510
|
+ "wires": [
|
|
511
|
+ [
|
|
512
|
+ "c8246e3ed2f6ac51"
|
|
513
|
+ ]
|
|
514
|
+ ]
|
|
515
|
+ },
|
|
516
|
+ {
|
|
517
|
+ "id": "6af17a7135211b49",
|
|
518
|
+ "type": "comment",
|
|
519
|
+ "z": "490116e54af5ff9a",
|
|
520
|
+ "name": "Set Lights",
|
|
521
|
+ "info": "",
|
|
522
|
+ "x": 100,
|
|
523
|
+ "y": 320,
|
|
524
|
+ "wires": []
|
|
525
|
+ },
|
|
526
|
+ {
|
|
527
|
+ "id": "23bd87871e2f0ecb",
|
|
528
|
+ "type": "debug",
|
|
529
|
+ "z": "490116e54af5ff9a",
|
|
530
|
+ "name": "Sun Event Data",
|
|
531
|
+ "active": true,
|
|
532
|
+ "tosidebar": true,
|
|
533
|
+ "console": false,
|
|
534
|
+ "tostatus": false,
|
|
535
|
+ "complete": "sunevent",
|
|
536
|
+ "targetType": "msg",
|
|
537
|
+ "statusVal": "",
|
|
538
|
+ "statusType": "auto",
|
|
539
|
+ "x": 980,
|
|
540
|
+ "y": 200,
|
|
541
|
+ "wires": []
|
|
542
|
+ },
|
|
543
|
+ {
|
|
544
|
+ "id": "b3edc5ecdc862850",
|
|
545
|
+ "type": "comment",
|
|
546
|
+ "z": "490116e54af5ff9a",
|
|
547
|
+ "name": "Initialize Sun State",
|
|
548
|
+ "info": "",
|
|
549
|
+ "x": 130,
|
|
550
|
+ "y": 40,
|
|
551
|
+ "wires": []
|
|
552
|
+ },
|
|
553
|
+ {
|
|
554
|
+ "id": "ac6c11189b8f1778",
|
|
555
|
+ "type": "inject",
|
|
556
|
+ "z": "490116e54af5ff9a",
|
|
557
|
+ "name": "Once",
|
|
558
|
+ "props": [
|
|
559
|
+ {
|
|
560
|
+ "p": "payload"
|
|
561
|
+ },
|
|
562
|
+ {
|
|
563
|
+ "p": "topic",
|
|
564
|
+ "vt": "str"
|
|
565
|
+ }
|
|
566
|
+ ],
|
|
567
|
+ "repeat": "",
|
|
568
|
+ "crontab": "",
|
|
569
|
+ "once": true,
|
|
570
|
+ "onceDelay": 0.1,
|
|
571
|
+ "topic": "",
|
|
572
|
+ "payloadType": "date",
|
|
573
|
+ "x": 90,
|
|
574
|
+ "y": 80,
|
|
575
|
+ "wires": [
|
|
576
|
+ [
|
|
577
|
+ "f66b01b2a01a9c70"
|
|
578
|
+ ]
|
|
579
|
+ ]
|
|
580
|
+ },
|
|
581
|
+ {
|
|
582
|
+ "id": "f66b01b2a01a9c70",
|
|
583
|
+ "type": "change",
|
|
584
|
+ "z": "490116e54af5ff9a",
|
|
585
|
+ "name": "Sunrise Sun State",
|
|
586
|
+ "rules": [
|
|
587
|
+ {
|
|
588
|
+ "t": "set",
|
|
589
|
+ "p": "sunevent",
|
|
590
|
+ "pt": "global",
|
|
591
|
+ "to": "sunrise",
|
|
592
|
+ "tot": "str"
|
|
593
|
+ }
|
|
594
|
+ ],
|
|
595
|
+ "action": "",
|
|
596
|
+ "property": "",
|
|
597
|
+ "from": "",
|
|
598
|
+ "to": "",
|
|
599
|
+ "reg": false,
|
|
600
|
+ "x": 250,
|
|
601
|
+ "y": 80,
|
|
602
|
+ "wires": [
|
|
603
|
+ []
|
|
604
|
+ ]
|
|
605
|
+ },
|
|
606
|
+ {
|
|
607
|
+ "id": "9c21e093193d54e4",
|
|
608
|
+ "type": "switch",
|
|
609
|
+ "z": "490116e54af5ff9a",
|
|
610
|
+ "name": "Is Sunrise?",
|
|
611
|
+ "property": "payload.sunevent",
|
|
612
|
+ "propertyType": "msg",
|
|
613
|
+ "rules": [
|
|
614
|
+ {
|
|
615
|
+ "t": "eq",
|
|
616
|
+ "v": "sunrise",
|
|
617
|
+ "vt": "str"
|
|
618
|
+ }
|
|
619
|
+ ],
|
|
620
|
+ "checkall": "true",
|
|
621
|
+ "repair": false,
|
|
622
|
+ "outputs": 1,
|
|
623
|
+ "x": 610,
|
|
624
|
+ "y": 240,
|
|
625
|
+ "wires": [
|
|
626
|
+ [
|
|
627
|
+ "0516f39aac309884"
|
|
628
|
+ ]
|
|
629
|
+ ]
|
|
630
|
+ },
|
|
631
|
+ {
|
|
632
|
+ "id": "4384fcd3b3567c6c",
|
|
633
|
+ "type": "switch",
|
|
634
|
+ "z": "490116e54af5ff9a",
|
|
635
|
+ "name": "Is Sunset?",
|
|
636
|
+ "property": "payload.sunevent",
|
|
637
|
+ "propertyType": "msg",
|
|
638
|
+ "rules": [
|
|
639
|
+ {
|
|
640
|
+ "t": "eq",
|
|
641
|
+ "v": "sunset",
|
|
642
|
+ "vt": "str"
|
|
643
|
+ }
|
|
644
|
+ ],
|
|
645
|
+ "checkall": "true",
|
|
646
|
+ "repair": false,
|
|
647
|
+ "outputs": 1,
|
|
648
|
+ "x": 610,
|
|
649
|
+ "y": 200,
|
|
650
|
+ "wires": [
|
|
651
|
+ [
|
|
652
|
+ "0516f39aac309884"
|
|
653
|
+ ]
|
|
654
|
+ ]
|
|
655
|
+ },
|
|
656
|
+ {
|
|
657
|
+ "id": "669b4c826982a274",
|
|
658
|
+ "type": "comment",
|
|
659
|
+ "z": "490116e54af5ff9a",
|
|
660
|
+ "name": "Only store relevant states",
|
|
661
|
+ "info": "",
|
|
662
|
+ "x": 630,
|
|
663
|
+ "y": 160,
|
|
664
|
+ "wires": []
|
|
665
|
+ },
|
|
666
|
+ {
|
|
667
|
+ "id": "e70de37a1b248a25",
|
|
668
|
+ "type": "inject",
|
|
669
|
+ "z": "74341bea93cc320d",
|
|
670
|
+ "name": "Every 1min",
|
|
671
|
+ "props": [
|
|
672
|
+ {
|
|
673
|
+ "p": "payload"
|
|
674
|
+ },
|
|
675
|
+ {
|
|
676
|
+ "p": "topic",
|
|
677
|
+ "vt": "str"
|
|
678
|
+ }
|
|
679
|
+ ],
|
|
680
|
+ "repeat": "60",
|
|
681
|
+ "crontab": "",
|
|
682
|
+ "once": true,
|
|
683
|
+ "onceDelay": "10",
|
|
684
|
+ "topic": "",
|
|
685
|
+ "payloadType": "date",
|
|
686
|
+ "x": 130,
|
|
687
|
+ "y": 100,
|
|
688
|
+ "wires": [
|
|
689
|
+ [
|
|
690
|
+ "4375482d5ce5df1c"
|
|
691
|
+ ]
|
|
692
|
+ ]
|
|
693
|
+ },
|
|
694
|
+ {
|
|
695
|
+ "id": "4375482d5ce5df1c",
|
|
696
|
+ "type": "change",
|
|
697
|
+ "z": "74341bea93cc320d",
|
|
698
|
+ "name": "Turn On",
|
|
699
|
+ "rules": [
|
|
700
|
+ {
|
|
701
|
+ "t": "set",
|
|
702
|
+ "p": "payload",
|
|
703
|
+ "pt": "msg",
|
|
704
|
+ "to": "on",
|
|
705
|
+ "tot": "str"
|
|
706
|
+ }
|
|
707
|
+ ],
|
|
708
|
+ "action": "",
|
|
709
|
+ "property": "",
|
|
710
|
+ "from": "",
|
|
711
|
+ "to": "",
|
|
712
|
+ "reg": false,
|
|
713
|
+ "x": 300,
|
|
714
|
+ "y": 100,
|
|
715
|
+ "wires": [
|
|
716
|
+ [
|
|
717
|
+ "9f7db20cf89cff6d"
|
|
718
|
+ ]
|
|
719
|
+ ]
|
|
720
|
+ },
|
|
721
|
+ {
|
|
722
|
+ "id": "86f29e0ed5d23b51",
|
|
723
|
+ "type": "comment",
|
|
724
|
+ "z": "74341bea93cc320d",
|
|
725
|
+ "name": "Keep bathroom fan always on",
|
|
726
|
+ "info": "Make sure fan is always turned on.\nNo sensors available yet to do this better.",
|
|
727
|
+ "x": 160,
|
|
728
|
+ "y": 60,
|
|
729
|
+ "wires": []
|
|
730
|
+ },
|
|
731
|
+ {
|
|
732
|
+ "id": "9f7db20cf89cff6d",
|
|
733
|
+ "type": "change",
|
|
734
|
+ "z": "74341bea93cc320d",
|
|
735
|
+ "name": "Bathroom Fan",
|
|
736
|
+ "rules": [
|
|
737
|
+ {
|
|
738
|
+ "t": "set",
|
|
739
|
+ "p": "topic",
|
|
740
|
+ "pt": "msg",
|
|
741
|
+ "to": "bathroom/fan",
|
|
742
|
+ "tot": "str"
|
|
743
|
+ }
|
|
744
|
+ ],
|
|
745
|
+ "action": "",
|
|
746
|
+ "property": "",
|
|
747
|
+ "from": "",
|
|
748
|
+ "to": "",
|
|
749
|
+ "reg": false,
|
|
750
|
+ "x": 480,
|
|
751
|
+ "y": 100,
|
|
752
|
+ "wires": [
|
|
753
|
+ [
|
|
754
|
+ "2e5626a57c7fdbe1"
|
|
755
|
+ ]
|
|
756
|
+ ]
|
|
757
|
+ },
|
|
758
|
+ {
|
|
759
|
+ "id": "2e5626a57c7fdbe1",
|
|
760
|
+ "type": "link call",
|
|
761
|
+ "z": "74341bea93cc320d",
|
|
762
|
+ "name": "",
|
|
763
|
+ "links": [
|
|
764
|
+ "fd3c7a7a7a3b2e99"
|
|
765
|
+ ],
|
|
766
|
+ "timeout": "30",
|
|
767
|
+ "x": 660,
|
|
768
|
+ "y": 100,
|
|
769
|
+ "wires": [
|
|
770
|
+ []
|
|
771
|
+ ]
|
|
772
|
+ },
|
|
773
|
+ {
|
|
774
|
+ "id": "e6010f1672bac815",
|
|
775
|
+ "type": "mqtt out",
|
|
776
|
+ "z": "b9932c4c66b18537",
|
|
777
|
+ "name": "IoT MQTT",
|
|
778
|
+ "topic": "",
|
|
779
|
+ "qos": "",
|
|
780
|
+ "retain": "",
|
|
781
|
+ "respTopic": "",
|
|
782
|
+ "contentType": "text/plain",
|
|
783
|
+ "userProps": "",
|
|
784
|
+ "correl": "",
|
|
785
|
+ "expiry": "",
|
|
786
|
+ "broker": "5be146a97e98891c",
|
|
787
|
+ "x": 210,
|
|
788
|
+ "y": 160,
|
|
789
|
+ "wires": []
|
|
790
|
+ },
|
|
791
|
+ {
|
|
792
|
+ "id": "8a4031a3be97bf0a",
|
|
793
|
+ "type": "debug",
|
|
794
|
+ "z": "b9932c4c66b18537",
|
|
795
|
+ "name": "Debug Print",
|
|
796
|
+ "active": true,
|
|
797
|
+ "tosidebar": true,
|
|
798
|
+ "console": false,
|
|
799
|
+ "tostatus": false,
|
|
800
|
+ "complete": "true",
|
|
801
|
+ "targetType": "full",
|
|
802
|
+ "statusVal": "",
|
|
803
|
+ "statusType": "auto",
|
|
804
|
+ "x": 210,
|
|
805
|
+ "y": 120,
|
|
806
|
+ "wires": []
|
|
807
|
+ },
|
|
808
|
+ {
|
|
809
|
+ "id": "fd3c7a7a7a3b2e99",
|
|
810
|
+ "type": "link in",
|
|
811
|
+ "z": "b9932c4c66b18537",
|
|
812
|
+ "name": "set_mqtt",
|
|
813
|
+ "links": [],
|
|
814
|
+ "x": 55,
|
|
815
|
+ "y": 80,
|
|
816
|
+ "wires": [
|
|
817
|
+ [
|
|
818
|
+ "8a4031a3be97bf0a",
|
|
819
|
+ "e6010f1672bac815",
|
|
820
|
+ "d185ca7a7211b37e"
|
|
821
|
+ ]
|
|
822
|
+ ]
|
|
823
|
+ },
|
|
824
|
+ {
|
|
825
|
+ "id": "db9d2ccfce698ced",
|
|
826
|
+ "type": "comment",
|
|
827
|
+ "z": "b9932c4c66b18537",
|
|
828
|
+ "name": "set_mqtt",
|
|
829
|
+ "info": "",
|
|
830
|
+ "x": 100,
|
|
831
|
+ "y": 40,
|
|
832
|
+ "wires": []
|
|
833
|
+ },
|
|
834
|
+ {
|
|
835
|
+ "id": "d185ca7a7211b37e",
|
|
836
|
+ "type": "link out",
|
|
837
|
+ "z": "b9932c4c66b18537",
|
|
838
|
+ "name": "",
|
|
839
|
+ "mode": "return",
|
|
840
|
+ "links": [],
|
|
841
|
+ "x": 155,
|
|
842
|
+ "y": 80,
|
|
843
|
+ "wires": []
|
|
844
|
+ }
|
|
845
|
+]
|
|
846
|
+</pre>
|
|
847
|
+
|
|
848
|
+The Node-RED installation is [handled by an ansible script](/sovereign.html).
|