View difference between Paste ID: RaHARWnr and wrzAGTpR
SHOW: | | - or go back to the newest paste.
1
[
2
    {
3
        "id": "8d8f8f8f.69daf",
4
        "type": "tab",
5-
        "label": "Day24_Christmas",
5+
        "label": "[K3_P14 - Bunte Lampe]",
6
        "disabled": true,
7
        "info": ""
8
    },
9
    {
10
        "id": "9d38ee90.ba703",
11
        "type": "ui_colour_picker",
12
        "z": "8d8f8f8f.69daf",
13
        "name": "",
14
        "label": "",
15
        "group": "4e7b9526.27213c",
16
        "format": "hsv",
17
        "outformat": "object",
18
        "showSwatch": true,
19
        "showPicker": true,
20
        "showValue": true,
21
        "showAlpha": false,
22
        "showLightness": true,
23
        "dynOutput": "false",
24
        "order": 0,
25
        "width": "6",
26
        "height": "4",
27
        "passthru": false,
28
        "topic": "",
29
        "x": 690,
30
        "y": 300,
31
        "wires": [
32
            [
33
                "51b77710.228718"
34
            ]
35
        ]
36
    },
37
    {
38
        "id": "b7b4bf21.6191a",
39
        "type": "ui_colour_picker",
40
        "z": "8d8f8f8f.69daf",
41
        "name": "",
42
        "label": "",
43
        "group": "4e7b9526.27213c",
44
        "format": "hsv",
45
        "outformat": "object",
46
        "showSwatch": true,
47
        "showPicker": true,
48
        "showValue": true,
49
        "showAlpha": false,
50
        "showLightness": true,
51
        "dynOutput": "false",
52
        "order": 0,
53
        "width": "6",
54
        "height": "4",
55
        "passthru": false,
56
        "topic": "",
57
        "x": 690,
58
        "y": 380,
59
        "wires": [
60
            [
61
                "2be9c963.126e06"
62
            ]
63
        ]
64
    },
65
    {
66
        "id": "e3fd77fb.52bd18",
67
        "type": "function",
68
        "z": "8d8f8f8f.69daf",
69
        "name": "FadeRound",
70
        "func": "var rgb_fade_fkt = global.get('rgb_fade_fkt')  ;\nif (rgb_fade_fkt) clearInterval(rgb_fade_fkt);\n\nif (msg.payload){\n    var fade_speed = global.get('fade_speed')||100;\n    rgb_fade_fkt = setInterval(fade_round, fade_speed);\n    global.set('rgb_fade_fkt',rgb_fade_fkt);\n\n}\n\nfunction fade_round(){\n        var rgb_hsv = global.get('rgb_hsv')||[[0,1,1],[0,1,1]];\n  \n    for (i = 0; i < rgb_hsv.length; i++) { \n         rgb_hsv[i][0] = (rgb_hsv[i][0]+1)%360;\n    }\n\n    global.set('rgb_hsv',rgb_hsv);\n    \n    msg.payload = rgb_hsv;\n    node.send(msg);\n}",
71
        "outputs": 1,
72
        "noerr": 0,
73
        "x": 350,
74
        "y": 140,
75
        "wires": [
76
            [
77
                "f18e095c.891618"
78
            ]
79
        ]
80
    },
81
    {
82
        "id": "51b77710.228718",
83
        "type": "function",
84
        "z": "8d8f8f8f.69daf",
85
        "name": "HSVtoArray",
86
        "func": "msg.payload = [msg.payload.h,msg.payload.s*100,msg.payload.v*100]\nreturn msg;",
87
        "outputs": 1,
88
        "noerr": 0,
89
        "x": 870,
90
        "y": 300,
91
        "wires": [
92
            [
93
                "c90b1306.5b59a"
94
            ]
95
        ]
96
    },
97
    {
98
        "id": "c90b1306.5b59a",
99
        "type": "change",
100
        "z": "8d8f8f8f.69daf",
101
        "name": "",
102
        "rules": [
103
            {
104
                "t": "set",
105
                "p": "rgb_hsv[0]",
106
                "pt": "global",
107
                "to": "payload",
108
                "tot": "msg"
109
            },
110
            {
111
                "t": "set",
112
                "p": "payload",
113
                "pt": "msg",
114
                "to": "true",
115
                "tot": "bool"
116
            }
117
        ],
118
        "action": "",
119
        "property": "",
120
        "from": "",
121
        "to": "",
122
        "reg": false,
123
        "x": 1060,
124
        "y": 300,
125
        "wires": [
126
            [
127
                "5b259b7e.cddd64"
128
            ]
129
        ]
130
    },
131
    {
132
        "id": "2be9c963.126e06",
133
        "type": "function",
134
        "z": "8d8f8f8f.69daf",
135
        "name": "HSVtoArray",
136
        "func": "msg.payload = [msg.payload.h,msg.payload.s*100,msg.payload.v*100]\nreturn msg;",
137
        "outputs": 1,
138
        "noerr": 0,
139
        "x": 870,
140
        "y": 380,
141
        "wires": [
142
            [
143
                "ce0d4238.03c7d"
144
            ]
145
        ]
146
    },
147
    {
148
        "id": "59f0d7cb.63a8c8",
149
        "type": "change",
150
        "z": "8d8f8f8f.69daf",
151
        "name": "",
152
        "rules": [
153
            {
154
                "t": "set",
155
                "p": "payload",
156
                "pt": "msg",
157
                "to": "rgb_hsv[1]",
158
                "tot": "global"
159
            }
160
        ],
161
        "action": "",
162
        "property": "",
163
        "from": "",
164
        "to": "",
165
        "reg": false,
166
        "x": 320,
167
        "y": 380,
168
        "wires": [
169
            [
170
                "22a3ea55.fa1b76"
171
            ]
172
        ]
173
    },
174
    {
175
        "id": "acc0cc02.25eae",
176
        "type": "change",
177
        "z": "8d8f8f8f.69daf",
178
        "name": "",
179
        "rules": [
180
            {
181
                "t": "set",
182
                "p": "payload",
183
                "pt": "msg",
184
                "to": "rgb_hsv[0]",
185
                "tot": "global"
186
            }
187
        ],
188
        "action": "",
189
        "property": "",
190
        "from": "",
191
        "to": "",
192
        "reg": false,
193
        "x": 320,
194
        "y": 300,
195
        "wires": [
196
            [
197
                "694102b5.06911c"
198
            ]
199
        ]
200
    },
201
    {
202
        "id": "694102b5.06911c",
203
        "type": "function",
204
        "z": "8d8f8f8f.69daf",
205
        "name": "ArrayToHSV",
206
        "func": "var newMsg = { payload: {h:0,s:0,v:0,a:1} };\nnewMsg.payload.h = msg.payload[0]\nnewMsg.payload.s =  msg.payload[1]/100\nnewMsg.payload.v = msg.payload[2]/100\n\nreturn newMsg;",
207
        "outputs": 1,
208
        "noerr": 0,
209
        "x": 510,
210
        "y": 300,
211
        "wires": [
212
            [
213
                "9d38ee90.ba703"
214
            ]
215
        ]
216
    },
217
    {
218
        "id": "22a3ea55.fa1b76",
219
        "type": "function",
220
        "z": "8d8f8f8f.69daf",
221
        "name": "ArrayToHSV",
222
        "func": "var newMsg = { payload: {h:0,s:0,v:0,a:1} };\nnewMsg.payload.h = msg.payload[0]\nnewMsg.payload.s =  msg.payload[1]/100\nnewMsg.payload.v = msg.payload[2]/100\n\nreturn newMsg;",
223
        "outputs": 1,
224
        "noerr": 0,
225
        "x": 510,
226
        "y": 380,
227
        "wires": [
228
            [
229
                "b7b4bf21.6191a"
230
            ]
231
        ]
232
    },
233
    {
234
        "id": "f18e095c.891618",
235
        "type": "link out",
236
        "z": "8d8f8f8f.69daf",
237
        "name": "fade_link",
238
        "links": [
239
            "1d46860a.2f230a",
240
            "206b2a83.dd29b6",
241
            "e0554a63.5e4328"
242
        ],
243
        "x": 535,
244
        "y": 140,
245
        "wires": []
246
    },
247
    {
248
        "id": "1d46860a.2f230a",
249
        "type": "link in",
250
        "z": "8d8f8f8f.69daf",
251
        "name": "",
252
        "links": [
253
            "f18e095c.891618",
254
            "4cca4fd5.6a598",
255
            "5b259b7e.cddd64"
256
        ],
257
        "x": 135,
258
        "y": 340,
259
        "wires": [
260
            [
261
                "acc0cc02.25eae",
262
                "59f0d7cb.63a8c8"
263
            ]
264
        ]
265
    },
266
    {
267
        "id": "bac9468c.6cc5c8",
268
        "type": "ui_switch",
269
        "z": "8d8f8f8f.69daf",
270
        "name": "",
271
        "label": "Start Fade",
272
        "group": "4e7b9526.27213c",
273
        "order": 0,
274
        "width": 0,
275
        "height": 0,
276
        "passthru": true,
277
        "decouple": "false",
278
        "topic": "",
279
        "style": "",
280
        "onvalue": "true",
281
        "onvalueType": "bool",
282
        "onicon": "",
283
        "oncolor": "",
284
        "offvalue": "false",
285
        "offvalueType": "bool",
286
        "officon": "",
287
        "offcolor": "",
288
        "x": 170,
289
        "y": 140,
290
        "wires": [
291
            [
292
                "e3fd77fb.52bd18"
293
            ]
294
        ]
295
    },
296
    {
297
        "id": "1377c163.b8efef",
298
        "type": "change",
299
        "z": "8d8f8f8f.69daf",
300
        "name": "",
301
        "rules": [
302
            {
303
                "t": "set",
304
                "p": "fade_speed",
305
                "pt": "global",
306
                "to": "payload",
307
                "tot": "msg"
308
            }
309
        ],
310
        "action": "",
311
        "property": "",
312
        "from": "",
313
        "to": "",
314
        "reg": false,
315
        "x": 380,
316
        "y": 200,
317
        "wires": [
318
            []
319
        ]
320
    },
321
    {
322
        "id": "52aba52.b178f5c",
323
        "type": "ui_numeric",
324
        "z": "8d8f8f8f.69daf",
325
        "name": "",
326
        "label": "Fade Speed",
327
        "group": "4e7b9526.27213c",
328
        "order": 0,
329
        "width": 0,
330
        "height": 0,
331
        "passthru": true,
332
        "topic": "",
333
        "format": "{{value}}",
334
        "min": "10",
335
        "max": "10000",
336
        "step": "10",
337
        "x": 170,
338
        "y": 200,
339
        "wires": [
340
            [
341
                "1377c163.b8efef"
342
            ]
343
        ]
344
    },
345
    {
346
        "id": "fc6ee7a5.47ce68",
347
        "type": "function",
348
        "z": "8d8f8f8f.69daf",
349
        "name": "HSVtoHEX",
350
        "func": "var rgb_hsv_v =msg.payload;\nvar rgb_hsv_out = [];\nrgb_hsv_v = msg.payload;\n\nfor (i = 0; i < rgb_hsv_v.length; i++) { \n     rgb_hsv_out[i] ='#'+rgbToHex(hsvToRgb(rgb_hsv_v[i]));\n}\nvar newmsg = {payload:rgb_hsv_out}\nreturn newmsg;\n\nfunction hsvToRgb(hsv) {\n    var h = hsv[0]; var s = hsv[1]; var v = hsv[2];\n    var r, g, b;\n    var i;\n    var f, p, q, t;\n\n    h = Math.max(0, Math.min(360, h));\n    s = Math.max(0, Math.min(100, s));\n    v = Math.max(0, Math.min(100, v));\n     \n    s /= 100;  v /= 100;\n     \n    if(s == 0) {\n        // Achromatic (grey)\n        r = g = b = v;\n        return [\n            Math.round(r * 255), \n            Math.round(g * 255), \n            Math.round(b * 255)\n        ];\n    }\n     \n    h /= 60; // sector 0 to 5\n    i = Math.floor(h);\n    f = h - i; // factorial part of h\n    p = v * (1 - s);\n    q = v * (1 - s * f);\n    t = v * (1 - s * (1 - f));\n     \n    switch(i) {\n        case 0:\n            r = v;g = t;b = p;break;\n        case 1:\n            r = q;g = v;b = p;break;\n        case 2:\n            r = p;g = v;b = t;break;\n        case 3:\n            r = p;g = q;b = v;break;\n        case 4:\n            r = t;g = p;b = v;break;\n        default: // case 5:\n            r = v;g = p;b = q;\n        }\n     \n    return [\n        Math.round(r * 255), \n        Math.round(g * 255), \n        Math.round(b * 255)\n    ];\n}\n\nfunction componentToHex(c) {\n    var hex = c.toString(16);\n    return hex.length == 1 ? \"0\" + hex : hex;\n}\n\nfunction rgbToHex(rgb) {\n    var r = rgb[0]; var g = rgb[1]; var b = rgb[2];\n    return componentToHex(r) + componentToHex(g) + componentToHex(b);\n}\n\n",
351
        "outputs": 1,
352
        "noerr": 0,
353
        "x": 510,
354
        "y": 480,
355
        "wires": [
356
            [
357
                "7529e5f7.e942bc"
358
            ]
359
        ]
360
    },
361
    {
362
        "id": "7529e5f7.e942bc",
363
        "type": "function",
364
        "z": "8d8f8f8f.69daf",
365
        "name": "set_pixel_array",
366
        "func": "var rgb_hsv_v =msg.payload;\n\nmsg.payload = '{\"cmd\":\"set_pixel_array\",\"rgb_array\":['\n\nfor (i = 0; i < rgb_hsv_v.length-1; i++) { \n    msg.payload += '\"'+rgb_hsv_v[i] +'\",'\n}\nmsg.payload += '\"'+rgb_hsv_v[rgb_hsv_v.length-1] +'\"]}';\nreturn msg;\n",
367
        "outputs": 1,
368
        "noerr": 0,
369
        "x": 700,
370
        "y": 480,
371
        "wires": [
372
            [
373
                "9cb047b8.710068"
374
            ]
375
        ]
376
    },
377
    {
378
        "id": "4e1a4cb4.fbba04",
379
        "type": "change",
380
        "z": "8d8f8f8f.69daf",
381
        "name": "",
382
        "rules": [
383
            {
384
                "t": "set",
385
                "p": "payload",
386
                "pt": "msg",
387
                "to": "rgb_hsv",
388
                "tot": "global"
389
            }
390
        ],
391
        "action": "",
392
        "property": "",
393
        "from": "",
394
        "to": "",
395
        "reg": false,
396
        "x": 320,
397
        "y": 480,
398
        "wires": [
399
            [
400
                "fc6ee7a5.47ce68"
401
            ]
402
        ]
403
    },
404
    {
405
        "id": "9cb047b8.710068",
406
        "type": "udp out",
407
        "z": "8d8f8f8f.69daf",
408
        "name": "",
409
        "addr": "192.168.178.255",
410
        "iface": "",
411
        "port": "55056",
412
        "ipv": "udp4",
413
        "outport": "",
414
        "base64": false,
415
        "multicast": "false",
416
        "x": 1020,
417
        "y": 480,
418
        "wires": []
419
    },
420
    {
421
        "id": "e0554a63.5e4328",
422
        "type": "link in",
423
        "z": "8d8f8f8f.69daf",
424
        "name": "",
425
        "links": [
426
            "f18e095c.891618",
427
            "4cca4fd5.6a598",
428
            "5b259b7e.cddd64"
429
        ],
430
        "x": 135,
431
        "y": 480,
432
        "wires": [
433
            [
434
                "4e1a4cb4.fbba04"
435
            ]
436
        ]
437
    },
438
    {
439
        "id": "5b259b7e.cddd64",
440
        "type": "link out",
441
        "z": "8d8f8f8f.69daf",
442
        "name": "fade_link",
443
        "links": [
444
            "1d46860a.2f230a",
445
            "206b2a83.dd29b6",
446
            "e0554a63.5e4328"
447
        ],
448
        "x": 1255,
449
        "y": 340,
450
        "wires": []
451
    },
452
    {
453
        "id": "ce0d4238.03c7d",
454
        "type": "change",
455
        "z": "8d8f8f8f.69daf",
456
        "name": "",
457
        "rules": [
458
            {
459
                "t": "set",
460
                "p": "rgb_hsv[1]",
461
                "pt": "global",
462
                "to": "payload",
463
                "tot": "msg"
464
            },
465
            {
466
                "t": "set",
467
                "p": "payload",
468
                "pt": "msg",
469
                "to": "true",
470
                "tot": "bool"
471
            }
472
        ],
473
        "action": "",
474
        "property": "",
475
        "from": "",
476
        "to": "",
477
        "reg": false,
478
        "x": 1060,
479
        "y": 380,
480
        "wires": [
481
            [
482
                "5b259b7e.cddd64"
483
            ]
484
        ]
485
    },
486
    {
487
        "id": "4e7b9526.27213c",
488
        "type": "ui_group",
489
        "z": "",
490-
        "name": "[Day24] Color Fade",
490+
        "name": "[K3_P14 - Bunte Lampe] ",
491
        "tab": "ac632043.9f452",
492
        "order": 1,
493
        "disp": true,
494
        "width": "6",
495
        "collapse": false
496
    },
497
    {
498
        "id": "ac632043.9f452",
499
        "type": "ui_tab",
500
        "z": "",
501-
        "name": "Day24",
501+
        "name": "[K3_P14] ",
502
        "icon": "dashboard",
503
        "order": 19
504
    }
505
]