-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodered.json
570 lines (570 loc) · 21.1 KB
/
nodered.json
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
[
{
"id": "e29db3c1.f2e7f",
"type": "http request",
"z": "a68cf5fe47562166",
"name": "",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.0.203/json/state",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 930,
"y": 140,
"wires": [
[]
]
},
{
"id": "5eecce7383e330e7",
"type": "inject",
"z": "a68cf5fe47562166",
"name": "PixelClock - 1min",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 20,
"wires": [
[
"aaa8fc54393037bb",
"74f768f8f60c30c4"
]
]
},
{
"id": "aaa8fc54393037bb",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Aktualna Godzina",
"func": "// Pobierz aktualną datę i godzinę\nvar now = new Date();\n\n// Uzyskaj godzinę i minuty w formacie HH:mm\nvar hours = now.getHours().toString().padStart(2, '0');\nvar minutes = now.getMinutes().toString().padStart(2, '0');\n\n// Utwórz formatowana godzinę\nvar formattedTime = hours + ':' + minutes;\n// Zwróć dane w odpowiednim formacie\nmsg.payload = {\n data: {\n text: formattedTime\n }\n};\n\nflow.set(\"CurrentTime\", formattedTime);\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 350,
"y": 20,
"wires": [
[
"613b615f14da8474"
]
]
},
{
"id": "c8f655e5cf265d1f",
"type": "mqtt out",
"z": "a68cf5fe47562166",
"name": "Czas",
"topic": "PixelClock/time",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ecbb6e3a7cecc487",
"x": 810,
"y": 20,
"wires": []
},
{
"id": "613b615f14da8474",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Wyslij przez MQTT",
"func": "// W przykładowej funkcji pobieramy zawartość pola \"text\" z przekazanego obiektu JSON\nvar jsonInput = msg.payload; // Pobieramy obiekt JSON z wejścia\n\nif (jsonInput && jsonInput.data && jsonInput.data.text) {\n // Jeżeli obiekt zawiera pole \"data\" oraz pole \"text\", to zwracamy zawartość pola \"text\"\n msg.payload = jsonInput.data.text;\n} else {\n // Jeżeli któryś z wymaganych kluczy nie istnieje, zwracamy pusty ciąg znaków\n msg.payload = \"Błąd\";\n}\n\nreturn msg; // Zwracamy wiadomość, którą można przekazać dalej w przepływie\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 20,
"wires": [
[
"c8f655e5cf265d1f"
]
]
},
{
"id": "adab77d2ed3ca6e5",
"type": "server-state-changed",
"z": "a68cf5fe47562166",
"name": "Czujnik Ruchu Gabinet",
"server": "27907644848a8562",
"version": 5,
"outputs": 2,
"exposeAsEntityConfig": "",
"entityId": "binary_sensor.gabinet_ruch_occupancy",
"entityIdType": "exact",
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 100,
"y": 200,
"wires": [
[
"2fbce360ab6dd7ed"
],
[
"af6427f210d55f90"
]
]
},
{
"id": "2fbce360ab6dd7ed",
"type": "api-current-state",
"z": "a68cf5fe47562166",
"name": "GoodNight",
"server": "27907644848a8562",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.goodnight",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 370,
"y": 180,
"wires": [
[
"1152e4be4da030e7"
],
[
"77ad646c6b7f31d4"
]
]
},
{
"id": "9aac9e65d1c27f37",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Wyłacz",
"func": "msg.payload = {\n on : false\n};\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 280,
"wires": [
[
"85bd20aebb7534e9"
]
]
},
{
"id": "77ad646c6b7f31d4",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Motyw Jasny",
"func": "var presetNumber = 2; // Zmiana numeru presetu według potrzeb\nvar aktualnyczas = flow.get(\"CurrentTime\");\n\nmsg.payload = {\n on : true,\n ps: presetNumber,\n seg: [\n {\n id: 0,\n n: aktualnyczas\n },\n ]\n};\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 200,
"wires": [
[
"85bd20aebb7534e9"
]
]
},
{
"id": "af6427f210d55f90",
"type": "delay",
"z": "a68cf5fe47562166",
"name": "",
"pauseType": "delay",
"timeout": "45",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 360,
"y": 240,
"wires": [
[
"9aac9e65d1c27f37"
]
]
},
{
"id": "1e4f71cb31e752e0",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Wyslij Czas",
"func": "var aktualnyczas = flow.get(\"CurrentTime\");\n\nmsg.payload = {\n seg: [\n {\n id: 0,\n n: aktualnyczas\n },\n ]\n};\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 80,
"wires": [
[
"85bd20aebb7534e9"
]
]
},
{
"id": "74f768f8f60c30c4",
"type": "delay",
"z": "a68cf5fe47562166",
"name": "",
"pauseType": "delay",
"timeout": "100",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 290,
"y": 80,
"wires": [
[
"1e4f71cb31e752e0"
]
]
},
{
"id": "73e262d6f26c81b7",
"type": "sun-event-inject",
"z": "a68cf5fe47562166",
"name": "Wschód Słońca",
"latitude": "52.027458",
"longitude": "21.036699",
"event": "sunrise",
"offset": "0",
"injectEventTimesAfterStartup": false,
"x": 120,
"y": 400,
"wires": [
[
"7f2091f706a9f869"
]
]
},
{
"id": "4bb9e0d96bdab5b6",
"type": "sun-event-inject",
"z": "a68cf5fe47562166",
"name": "Zachód Słońca",
"latitude": "52.027458",
"longitude": "21.036699",
"event": "sunsetStart",
"offset": "0",
"injectEventTimesAfterStartup": false,
"x": 120,
"y": 460,
"wires": [
[
"0c53f06fce0fad93"
]
]
},
{
"id": "0c53f06fce0fad93",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Ściemniam",
"func": "// Początkowa i końcowa wartość\nconst startValue = 150;\nconst endValue = 2;\n\n// Czas trwania animacji w sekundach\n//const animationDuration = 60; // 60 sekund\nconst animationDuration = 2000; // 30 minut\n\n// Częstotliwość generowania nowej wartości (co ile milisekund)\nconst updateInterval = 30000; // co 60 razy na sekundę\n\n// Liczba kroków interpolacji\nconst steps = animationDuration * 60; // 60 kroków na sekundę przez 60 sekund\n\n// Zmienna do przechowywania aktualnego kroku interpolacji\nlet currentStep = 0;\n\n// Zmienna do przechowywania interwału\nlet intervalId;\n\n// Zmienna do przechowywania stanu odliczania\nlet odliczanieTrwa = false;\n\n// Funkcja generująca płynne wartości\nfunction generateSmoothValues() {\n // Jeśli odliczanie trwa, nie generuj nowych wartości\n if (odliczanieTrwa) {\n return;\n }\n\n // Obliczanie nowej wartości przy użyciu interpolacji liniowej\n const progress = currentStep / steps;\n const valueDifference = endValue - startValue;\n const interpolatedValue = startValue + progress * valueDifference;\n\n // Zaokrąglanie wartości w dół do najbliższej liczby całkowitej\n const currentValue = Math.floor(interpolatedValue);\n\n // Wysyłanie wartości do wyjścia\n node.send({ payload: currentValue });\n\n // Sprawdzenie warunku zakończenia animacji\n if (currentStep >= steps) {\n // Zakończ animację\n clearInterval(intervalId);\n }\n\n // Zwiększenie aktualnego kroku\n currentStep++;\n}\n\n// Funkcja obsługująca zdarzenie kliknięcia Inject\nfunction onClickInject() {\n // Jeśli odliczanie trwa, nie uruchamiaj nowej animacji\n if (odliczanieTrwa) {\n return;\n }\n\n // Zakończ poprzednią animację, jeśli istnieje\n clearInterval(intervalId);\n\n // Zresetuj wszystkie wartości do stanu początkowego\n currentStep = 0;\n\n // Ustaw flagę odliczania\n odliczanieTrwa = true;\n\n // Ustawienie interwału do generowania wartości\n intervalId = setInterval(() => {\n generateSmoothValues();\n\n // Sprawdzenie warunku zakończenia animacji\n if (currentStep >= steps) {\n // Zakończ animację\n clearInterval(intervalId);\n\n // Zresetuj flagę odliczania\n odliczanieTrwa = false;\n }\n }, updateInterval);\n}\n\n// Ustawienie interwału do generowania wartości\nintervalId = setInterval(generateSmoothValues, updateInterval);\n\n// Zarejestrowanie funkcji obsługującej kliknięcie Inject\nmsg.on('input', onClickInject);\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 460,
"wires": [
[
"ba9370184dad581a"
]
]
},
{
"id": "7f2091f706a9f869",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Rozjaśniam",
"func": "// Początkowa i końcowa wartość\nconst startValue = 2;\nconst endValue = 150;\n\n// Czas trwania animacji w minutach\nconst animationDuration = 30 * 60; // 30 minut w sekundach\n\n// Częstotliwość generowania nowej wartości (co ile milisekund)\nconst updateInterval = 1000 / 60; // co 60 razy na sekundę\n\n// Liczba kroków interpolacji\nconst steps = animationDuration * 60; // 60 kroków na sekundę przez 60 sekund\n\n// Zmienna do przechowywania aktualnego kroku interpolacji\nlet currentStep = 0;\n\n// Zmienna do przechowywania interwału\nlet intervalId;\n\n// Zmienna do przechowywania stanu odliczania\nlet odliczanieTrwa = false;\n\n// Funkcja generująca płynne wartości\nfunction generateSmoothValues() {\n // Jeśli odliczanie trwa, nie generuj nowych wartości\n if (odliczanieTrwa) {\n return;\n }\n\n // Obliczanie nowej wartości przy użyciu interpolacji liniowej\n const progress = currentStep / steps;\n const valueDifference = endValue - startValue;\n const interpolatedValue = startValue + progress * valueDifference;\n\n // Zaokrąglanie wartości w dół do najbliższej liczby całkowitej\n const currentValue = Math.floor(interpolatedValue);\n\n // Wysyłanie wartości do wyjścia\n node.send({ payload: currentValue });\n\n // Sprawdzenie warunku zakończenia animacji\n if (currentStep >= steps) {\n // Zakończ animację\n clearInterval(intervalId);\n }\n\n // Zwiększenie aktualnego kroku\n currentStep++;\n}\n\n// Funkcja obsługująca zdarzenie kliknięcia Inject\nfunction onClickInject() {\n // Jeśli odliczanie trwa, nie uruchamiaj nowej animacji\n if (odliczanieTrwa) {\n return;\n }\n\n // Zakończ poprzednią animację, jeśli istnieje\n clearInterval(intervalId);\n\n // Zresetuj wszystkie wartości do stanu początkowego\n currentStep = 0;\n\n // Ustaw flagę odliczania\n odliczanieTrwa = true;\n\n // Ustawienie interwału do generowania wartości\n intervalId = setInterval(() => {\n generateSmoothValues();\n\n // Sprawdzenie warunku zakończenia animacji\n if (currentStep >= steps) {\n // Zakończ animację\n clearInterval(intervalId);\n\n // Zresetuj flagę odliczania\n odliczanieTrwa = false;\n }\n }, updateInterval);\n}\n\n// Ustawienie interwału do generowania wartości\nintervalId = setInterval(generateSmoothValues, updateInterval);\n\n// Zarejestrowanie funkcji obsługującej kliknięcie Inject\nmsg.on('input', onClickInject);\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 400,
"wires": [
[
"ba9370184dad581a"
]
]
},
{
"id": "ba9370184dad581a",
"type": "api-current-state",
"z": "a68cf5fe47562166",
"name": "GoodNight",
"server": "27907644848a8562",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.goodnight",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "msg",
"propertyType": "flow",
"value": "",
"valueType": "num"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 510,
"y": 400,
"wires": [
[],
[
"867adbd4a5cc61a6"
]
]
},
{
"id": "1152e4be4da030e7",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Motyw Ciemny",
"func": "var presetNumber = 4; // Zmiana numeru presetu według potrzeb\nvar aktualnyczas = flow.get(\"CurrentTime\");\n\nmsg.payload = {\n on : true,\n ps: presetNumber,\n seg: [\n {\n id: 0,\n n: aktualnyczas\n },\n ]\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 580,
"y": 160,
"wires": [
[
"85bd20aebb7534e9"
]
]
},
{
"id": "867adbd4a5cc61a6",
"type": "function",
"z": "a68cf5fe47562166",
"name": "Motyw Ciemny",
"func": "// Pobierz poprzednią wartość z kontekstu\nvar poprzedniaWartosc = flow.get(\"PoprzedniaWartosc\");\n\n// Sprawdź, czy msg.payload różni się od poprzedniej wartości\nif (msg.payload !== poprzedniaWartosc) {\n // Zapisz aktualną wartość jako poprzednią wartość\n flow.set(\"PoprzedniaWartosc\", msg.payload);\n\n // Przygotuj dane do przekazania dalej\n var aktualnyczas = flow.get(\"CurrentTime\");\n msg.payload = {\n bri: msg.payload,\n on: true,\n seg: [\n {\n id: 0,\n n: aktualnyczas\n },\n ]\n };\n\n return msg;\n} else {\n // Jeśli wartość się nie zmieniła, nie przekazuj dalej\n return null;\n}",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 680,
"y": 340,
"wires": [
[
"61cb8b6f9cbc6ad7",
"85bd20aebb7534e9"
]
]
},
{
"id": "61cb8b6f9cbc6ad7",
"type": "debug",
"z": "a68cf5fe47562166",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 950,
"y": 200,
"wires": []
},
{
"id": "85bd20aebb7534e9",
"type": "mqtt out",
"z": "a68cf5fe47562166",
"name": "WLED MQTT",
"topic": "PixelClock/NO1/api",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "ecbb6e3a7cecc487",
"x": 920,
"y": 80,
"wires": []
},
{
"id": "ecbb6e3a7cecc487",
"type": "mqtt-broker",
"name": "NAS",
"broker": "192.168.0.16",
"port": "33002",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "27907644848a8562",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": ": ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "default",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": false
}
]