forked from homeean/node-red-contrib-homee-flows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHue Flow mit rgb und Rückkanal.json
106 lines (106 loc) · 7.62 KB
/
Hue Flow mit rgb und Rückkanal.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
[
{
"id": "fc2c7f6b.0be25",
"type": "hue-light",
"z": "836c10fc.08628",
"name": "Extended color light 1",
"bridge": "30d6676b.dc4778",
"lightid": "12",
"colornamer": true,
"x": 580,
"y": 120,
"wires": [
[
"9a071797.bd8338"
]
]
},
{
"id": "e06aa33.ab0dd6",
"type": "function",
"z": "836c10fc.08628",
"name": "Rückkanal on off mit Hex",
"func": "if (msg.payload.on === true ){msg.payload.on =1}else msg.payload.on=0; \nnode.send({payload:{\"id\":40,\"value\":msg.payload.on}})\nnode.send({payload:{\"id\":41,\"value\":msg.payload.brightness}})\nnode.send({payload:{\"id\":42,\"value\":msg.payload.colorTemp}})\nnode.send({payload:{\"id\":44,\"value\":msg.payload.rgb[0]}})\nnode.send({payload:{\"id\":45,\"value\":msg.payload.rgb[1]}})\nnode.send({payload:{\"id\":46,\"value\":msg.payload.rgb[2]}})\n\n\nif( msg.payload.hex){\nvar test = msg.payload.hex.split('');\nvar ausgabe = \"\";\numr(i = test[5]);\nZahl1 = ausgabe*1;\numr(i = test[4]);\nZahl2 = ausgabe*16;\numr(i = test[3]);\nZahl3 = ausgabe*256;\numr(i = test[2]);\nZahl4 = ausgabe*4096;\numr(i = test[1]);\nZahl5 = ausgabe*65536;\numr(i = test[0]);\nZahl6 = ausgabe*1048576;\nnode.send({payload: {\"id\":43,\"value\":Zahl1+Zahl2+Zahl3+Zahl4+Zahl5+Zahl6}})}\nfunction umr(){\n switch(i){\n\t\tcase \"1\": ausgabe =1;break;\n\t\tcase \"2\": ausgabe =2;break;\n\t\tcase \"3\": ausgabe = 3;break;\n\t\tcase \"4\": ausgabe= 4;break;\n\t\tcase \"5\": ausgabe= 5;break;\n\t\tcase \"6\": ausgabe = 6;break;\n\t\tcase \"7\": ausgabe =7;break; \n\t\tcase \"8\": ausgabe = 8;break;\n\t\tcase \"9\": ausgabe = 9;break;\n\t\tcase \"a\": ausgabe =10; break;\n\t\tcase \"b\": ausgabe = 11; break;\n\t\tcase \"c\": ausgabe = 12; break;\n\t\tcase \"d\": ausgabe =13; break;\n\t\tcase \"e\": ausgabe =14; break;\n\t\tcase \"f\": ausgabe =15; break;\n}}",
"outputs": 1,
"noerr": 0,
"x": 930,
"y": 120,
"wires": [
[
"e8a64a94.9a6a78"
]
]
},
{
"id": "9a071797.bd8338",
"type": "switch",
"z": "836c10fc.08628",
"name": "",
"property": "payload.reachable",
"propertyType": "msg",
"rules": [
{
"t": "true"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 750,
"y": 120,
"wires": [
[
"e06aa33.ab0dd6"
]
]
},
{
"id": "e8a64a94.9a6a78",
"type": "homeeDevice",
"z": "836c10fc.08628",
"homee-sim": "3cb0442.da4adbc",
"name": "Osram Strip Wohnen ",
"nodeId": "40",
"profile": "1002",
"icon": "",
"attributes": "[{\"id\":40,\"node_id\":40,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":1,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":41,\"node_id\":40,\"instance\":0,\"minimum\":0,\"maximum\":100,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"%25\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":42,\"node_id\":40,\"instance\":0,\"minimum\":153,\"maximum\":500,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"K\",\"step_value\":1,\"editable\":1,\"type\":42,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":43,\"node_id\":40,\"instance\":0,\"minimum\":0,\"maximum\":16777215,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":23,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"7001020%3B16419669%3B12026363%3B16525995\"},{\"id\":44,\"node_id\":40,\"instance\":1,\"minimum\":0,\"maximum\":255,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"RED\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":45,\"node_id\":40,\"instance\":2,\"minimum\":0,\"maximum\":255,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"Green\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":46,\"node_id\":40,\"instance\":3,\"minimum\":0,\"maximum\":255,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"BLUE\",\"step_value\":1,\"editable\":1,\"type\":2,\"state\":1,\"last_changed\":12345555,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]",
"x": 120,
"y": 120,
"wires": [
[
"dbe8403e.5660a"
]
]
},
{
"id": "dbe8403e.5660a",
"type": "function",
"z": "836c10fc.08628",
"name": "RGB Funktion",
"func": "if (msg.payload.attributeId === 44){flow.set(\"red\",msg.payload.targetValue)}\nif (msg.payload.attributeId === 45){flow.set(\"green\",msg.payload.targetValue)}\nif (msg.payload.attributeId === 46){flow.set(\"blue\",msg.payload.targetValue)}\nvar red = flow.get(\"red\")||0;\nvar green = flow.get(\"green\")||0;\nvar blue = flow.get(\"blue\")||0;\nif (msg.payload.attributeId === 43){\nvar zahl= msg.payload.targetValue;\nvar ausgabe =\"\";\nrest(i = zahl%16);\nzahl6 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl5 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl4 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl3 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl2 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl);\nzahl1 = ausgabe;\n\nausgabe2 = zahl1+zahl2+zahl3+zahl4+zahl5+zahl6;\n node.send({payload:{\"hex\":ausgabe2}});\n}\n\nfunction rest(){\n switch(i)\n\t\t{\n\t\t \n\t\tcase 1: ausgabe =\"1\";break;\n\t\tcase 2: ausgabe =\"2\";break;\n\t\tcase 3: ausgabe = \"3\";break;\n\t\tcase 4: ausgabe= \"4\";break;\n\t\tcase 5: ausgabe= \"5\";break;\n\t\tcase 6: ausgabe = \"6\";break;\n\t\tcase 7: ausgabe =\"7\";break; \n\t\tcase 8: ausgabe = \"8\";break;\n\t\tcase 9: ausgabe = \"9\";break;\n\t\tcase 10: ausgabe =\"A\"; break;\n\t\tcase 11: ausgabe = \"B\"; break;\n\t\tcase 12: ausgabe = \"C\"; break;\n\t\tcase 13: ausgabe =\"D\"; break;\n\t\tcase 14: ausgabe =\"E\"; break;\n\t\tcase 15: ausgabe =\"F\"; break;\n}}\n\nif (msg.payload.attributeId === 40){node.send({payload:{\"on\":msg.payload.targetValue}})}\nif (msg.payload.attributeId === 41){node.send({payload:{\"brightness\":msg.payload.targetValue}})}\nif (msg.payload.attributeId === 42){node.send({payload:{\"colorTemp\":msg.payload.targetValue}})}\nif ((msg.payload.attributeId === 44)||(msg.payload.attributeId === 45)||(msg.payload.attributeId === 46)){node.send({payload:{rgb:{\"0\":red,\"1\":green,\"2\":blue}}})}",
"outputs": 1,
"noerr": 0,
"x": 360,
"y": 120,
"wires": [
[
"fc2c7f6b.0be25"
]
]
},
{
"id": "30d6676b.dc4778",
"type": "hue-bridge",
"z": "",
"name": "Philips hue",
"bridge": "192.168.178.51",
"key": "IDcZjnXk6jQoQl1hSoMRaOkNFzy4KD6WYOb0dBzw",
"interval": "3000"
},
{
"id": "3cb0442.da4adbc",
"type": "virtualHomee",
"z": "",
"name": "1234"
}
]