-
Notifications
You must be signed in to change notification settings - Fork 18
/
Xiaomi Mijia Bedside Lamp 2 (alternativ andere Yeelight) in hih
1 lines (1 loc) · 4.35 KB
/
Xiaomi Mijia Bedside Lamp 2 (alternativ andere Yeelight) in hih
1
[{"id":"6877517e.d9b2f","type":"change","z":"fd6d95c1.d70ae8","name":"","rules":[{"t":"change","p":"payload.on","pt":"msg","from":"0","fromt":"num","to":"false","tot":"bool"},{"t":"change","p":"payload.on","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":2780,"wires":[["ab5e6312.b27b08"]]},{"id":"b07f6128.ead65","type":"homeeDevice","z":"fd6d95c1.d70ae8","virtual-homee":"","name":"Bedside Michael","nodeId":"810","profile":"1002","icon":"default","attributes":"[{\"id\":810,\"node_id\":810,\"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\":811,\"node_id\":810,\"instance\":0,\"minimum\":0,\"maximum\":255,\"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\":812,\"node_id\":810,\"instance\":0,\"minimum\":1700,\"maximum\":6500,\"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\":813,\"node_id\":810,\"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\"}]","x":230,"y":2780,"wires":[["51ab57b0.cd4c4"]]},{"id":"9edb51bf.5c86d8","type":"yeelight-compat-hue-state","z":"fd6d95c1.d70ae8","name":"","server":"73ebd62.d8331a8","x":1010,"y":2780,"wires":[["79e559c6.758ea"]]},{"id":"51ab57b0.cd4c4","type":"function","z":"fd6d95c1.d70ae8","name":"RGB Funktion","func":"if (msg.payload.attributeId === 813){\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 === 810){node.send({payload:{\"on\":msg.payload.targetValue}})}\nif (msg.payload.attributeId === 811){node.send({payload:{\"bri\":msg.payload.targetValue}})}\nif (msg.payload.attributeId === 812){node.send({payload:{\"ct\":msg.payload.targetValue}})}","outputs":1,"noerr":0,"x":440,"y":2780,"wires":[["6877517e.d9b2f"]]},{"id":"79e559c6.758ea","type":"function","z":"fd6d95c1.d70ae8","name":"Rückkanal","func":"if (msg.payload.state.on === true ){msg.payload.on =1}else msg.payload.on=0; \nnode.send({payload:{\"attribute\":{\"id\":810,\"value\":msg.payload.on}}})\nnode.send({payload:{\"attribute\":{\"id\":811,\"value\":msg.payload.state.bri}}})\nnode.send({payload:{\"attribute\":{\"id\":812,\"value\":parseFloat(msg.payload.raw.ct)}}})\nnode.send({payload:{\"attribute\":{\"id\":813,\"value\":parseFloat(msg.payload.raw.rgb)}}})\n\n","outputs":1,"noerr":0,"x":1190,"y":2780,"wires":[["b07f6128.ead65"]]},{"id":"ab5e6312.b27b08","type":"yeelight-compat-hue-out","z":"fd6d95c1.d70ae8","name":"","server":"73ebd62.d8331a8","x":830,"y":2780,"wires":[]},{"id":"73ebd62.d8331a8","type":"yeelight-compat-hue-config","z":"","hostname":"192.168.1.87","port":"55443","name":"Micha_Bed"}]