NEWS
Mit amazon-echo tuya lokal steuern
-
Bin schon relativ weit.
Nutze- node-red-contrib-amazon-echo für die Lokale Echo integration
- node-red-contrib-color-convert für RGB nach HSV, da der hue wert aus amazon-echo mir nicht so zusagt
zwei tuya rgb LED Strips Datenpunkt sind im ioBroker eingelesen
An/aus ist jetzt nicht so das Problem.
Farben setzt man über z.B. für rot 100% Helligkeit:
color_data 000003e803e8
hue 0000 möglicher Bereich 0 - 360
sat 03e8 möglicher Bereich 0 - 1000
value 03e8 möglicher Bereich0 - 1000kann schon mal die Ausgabe aus dem echo node in die Bereiche bringen
[ { "id": "c898591b.0e6fe8", "type": "tab", "label": "Test Tuya", "disabled": false, "info": "" }, { "id": "32ab7202.1284ee", "type": "debug", "z": "c898591b.0e6fe8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 250, "y": 440, "wires": [] }, { "id": "b7ed32a5.e1d11", "type": "change", "z": "c898591b.0e6fe8", "name": "", "rules": [ { "t": "move", "p": "rgb", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 240, "y": 220, "wires": [ [ "d84bff51.26272" ] ] }, { "id": "6fb8b57d.2a653c", "type": "link in", "z": "c898591b.0e6fe8", "name": "Test Tuya", "links": [ "d06fcf08.164fd" ], "x": 115, "y": 220, "wires": [ [ "32ab7202.1284ee", "b7ed32a5.e1d11" ] ] }, { "id": "d84bff51.26272", "type": "color-convert", "z": "c898591b.0e6fe8", "input": "rgb", "output": "hsv", "outputType": "object", "scaleInput": false, "x": 410, "y": 220, "wires": [ [ "cd2bfe21.53877" ] ] }, { "id": "b4f125ae.2dfb88", "type": "debug", "z": "c898591b.0e6fe8", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 910, "y": 220, "wires": [] }, { "id": "cd2bfe21.53877", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "100", "minout": "0", "maxout": "1000", "action": "scale", "round": true, "property": "payload.saturation", "name": "saturation", "x": 580, "y": 220, "wires": [ [ "5fe5b78e.4c1578" ] ] }, { "id": "5fe5b78e.4c1578", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "100", "minout": "0", "maxout": "1000", "action": "scale", "round": true, "property": "payload.value", "name": "value", "x": 750, "y": 220, "wires": [ [ "b4f125ae.2dfb88" ] ] } ]
muss jetzt aber noch die payload z.B. für rot
{"hue":0,"saturation":1000,"value":1000}
in das Tuya color_data 000003e803e8 sting bringen.
Werde dann mal googlen. Wenn Ihr Ideen habt, nur zu
-
So geht es. In der Alexa bekommt sogar Änderungen bei IR Fernbedienung mit.
[ { "id": "c898591b.0e6fe8", "type": "tab", "label": "Lena Tuya", "disabled": false, "info": "" }, { "id": "6fb8b57d.2a653c", "type": "link in", "z": "c898591b.0e6fe8", "name": "Test Tuya", "links": [ "d06fcf08.164fd" ], "x": 115, "y": 280, "wires": [ [ "24745777.87ea88", "2d3cb289.c9ceae" ] ] }, { "id": "24745777.87ea88", "type": "switch", "z": "c898591b.0e6fe8", "name": "colormode", "property": "colormode", "propertyType": "msg", "rules": [ { "t": "eq", "v": "hs", "vt": "str" }, { "t": "eq", "v": "ct", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 250, "y": 220, "wires": [ [ "5efba10b.dce29" ], [ "8f00528b.9763d" ] ] }, { "id": "5efba10b.dce29", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "254", "minout": "0", "maxout": "1000", "action": "scale", "round": true, "property": "sat", "name": "saturation", "x": 480, "y": 180, "wires": [ [ "7bc350fb.2de61" ] ] }, { "id": "7bc350fb.2de61", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "254", "minout": "0", "maxout": "1000", "action": "scale", "round": true, "property": "bri", "name": "value", "x": 630, "y": 180, "wires": [ [ "e2b9d916.379268" ] ] }, { "id": "e2b9d916.379268", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "65563", "minout": "0", "maxout": "360", "action": "scale", "round": true, "property": "hue", "name": "hue", "x": 770, "y": 180, "wires": [ [ "86ddc18c.0f5cd" ] ] }, { "id": "86ddc18c.0f5cd", "type": "function", "z": "c898591b.0e6fe8", "name": "joinToHexString", "func": "msg.bri = toHex(msg.bri)\nmsg.sat = toHex(msg.sat)\nmsg.hue = toHex(msg.hue)\n\nlet arr = [msg.hue, msg.sat, msg.bri];\nmsg.payload = arr.join(\"\");\nreturn msg;\n\nfunction toHex(decimal) { // This converts a number to a string Hex AND adds padding zeros to a set number of characters.\n return (decimal + Math.pow(16, 4)).toString(16).slice(-4)\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 940, "y": 180, "wires": [ [ "68a011f.1c0b6f" ] ] }, { "id": "8f00528b.9763d", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "254", "minout": "0", "maxout": "1000", "action": "scale", "round": true, "property": "bri", "name": "value", "x": 470, "y": 260, "wires": [ [ "1cb5e65b.c81d1a" ] ] }, { "id": "1cb5e65b.c81d1a", "type": "function", "z": "c898591b.0e6fe8", "name": "joinToHexString", "func": "msg.bri = toHex(msg.bri)\nmsg.sat = \"0000\"\nmsg.hue = \"0000\"\n\nlet arr = [msg.hue, msg.sat, msg.bri];\nmsg.payload = arr.join(\"\");\nreturn msg;\n\nfunction toHex(decimal) { // This converts a number to a string Hex AND adds padding zeros to a set number of characters.\n return (decimal + Math.pow(16, 4)).toString(16).slice(-4)\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 940, "y": 260, "wires": [ [ "68a011f.1c0b6f" ] ] }, { "id": "2d3cb289.c9ceae", "type": "switch", "z": "c898591b.0e6fe8", "name": "on/off", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "on", "vt": "str" }, { "t": "eq", "v": "off", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 230, "y": 340, "wires": [ [ "7478ffb4.d10b8" ], [ "e6f736ec.004098" ] ] }, { "id": "7478ffb4.d10b8", "type": "change", "z": "c898591b.0e6fe8", "name": "true", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 320, "wires": [ [ "4be3cd26.926364" ] ] }, { "id": "e6f736ec.004098", "type": "change", "z": "c898591b.0e6fe8", "name": "flase", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 360, "wires": [ [ "4be3cd26.926364" ] ] }, { "id": "4be3cd26.926364", "type": "ioBroker out", "z": "c898591b.0e6fe8", "name": "Lena Tuya LED Strip switch_led", "topic": "tuya.0.08200118e868e759568a.20", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 990, "y": 360, "wires": [] }, { "id": "68a011f.1c0b6f", "type": "ioBroker out", "z": "c898591b.0e6fe8", "name": "Lena Tuya LED Strip color_data", "topic": "tuya.0.08200118e868e759568a.24", "ack": "false", "autoCreate": "false", "stateName": "", "role": "", "payloadType": "", "readonly": "", "stateUnit": "", "stateMin": "", "stateMax": "", "x": 1190, "y": 220, "wires": [] }, { "id": "b766d64f.558e38", "type": "ioBroker in", "z": "c898591b.0e6fe8", "name": "color_mode", "topic": "tuya.0.08200118e868e759568a.24", "payloadType": "value", "onlyack": true, "func": "all", "gap": "", "fireOnStart": "false", "x": 250, "y": 780, "wires": [ [ "a3eb0958.b769e8" ] ] }, { "id": "52f07af3.8b1f44", "type": "ioBroker in", "z": "c898591b.0e6fe8", "name": "switch_led", "topic": "tuya.0.08200118e868e759568a.20", "payloadType": "value", "onlyack": true, "func": "all", "gap": "", "fireOnStart": "false", "x": 240, "y": 600, "wires": [ [ "c275b713.8d6788" ] ] }, { "id": "c275b713.8d6788", "type": "change", "z": "c898591b.0e6fe8", "name": "on", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" }, { "t": "set", "p": "payload.nodeid", "pt": "msg", "to": "6db05f00.c9783", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 600, "wires": [ [ "81e46aff.74a0d8" ] ] }, { "id": "a3eb0958.b769e8", "type": "split", "z": "c898591b.0e6fe8", "name": "", "splt": "4", "spltType": "len", "arraySplt": "1", "arraySpltType": "len", "stream": false, "addname": "", "x": 390, "y": 780, "wires": [ [ "5177cbe7.485ab4" ] ] }, { "id": "5177cbe7.485ab4", "type": "join", "z": "c898591b.0e6fe8", "name": "", "mode": "custom", "build": "array", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "3", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "num", "reduceFixup": "", "x": 510, "y": 780, "wires": [ [ "92af89f0.547b48" ] ] }, { "id": "92af89f0.547b48", "type": "change", "z": "c898591b.0e6fe8", "name": "", "rules": [ { "t": "move", "p": "payload.0", "pt": "msg", "to": "hue", "tot": "msg" }, { "t": "move", "p": "payload.1", "pt": "msg", "to": "sat", "tot": "msg" }, { "t": "move", "p": "payload.2", "pt": "msg", "to": "bri", "tot": "msg" }, { "t": "delete", "p": "payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 670, "y": 780, "wires": [ [ "4e112b70.633bc4" ] ] }, { "id": "8eb7f14.6ee0c1", "type": "comment", "z": "c898591b.0e6fe8", "name": "set Tuya", "info": "", "x": 240, "y": 100, "wires": [] }, { "id": "cfb4977b.415fd8", "type": "comment", "z": "c898591b.0e6fe8", "name": "get Tuya", "info": "", "x": 240, "y": 480, "wires": [] }, { "id": "9826af61.305f2", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "360", "minout": "0", "maxout": "65563", "action": "scale", "round": true, "property": "hue", "name": "hue", "x": 250, "y": 680, "wires": [ [ "a3add1ea.138f1" ] ] }, { "id": "4e112b70.633bc4", "type": "function", "z": "c898591b.0e6fe8", "name": "", "func": "msg.hue = parseInt(msg.hue,16);\nmsg.sat = parseInt(msg.sat,16);\nmsg.bri = parseInt(msg.bri,16)\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 860, "y": 780, "wires": [ [ "9826af61.305f2" ] ] }, { "id": "a3add1ea.138f1", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "1000", "minout": "0", "maxout": "254", "action": "scale", "round": true, "property": "sat", "name": "saturation", "x": 380, "y": 680, "wires": [ [ "81962849.8fc1f8" ] ] }, { "id": "81962849.8fc1f8", "type": "range", "z": "c898591b.0e6fe8", "minin": "0", "maxin": "1000", "minout": "0", "maxout": "254", "action": "scale", "round": true, "property": "bri", "name": "value", "x": 510, "y": 680, "wires": [ [ "b5006a27.98cc48" ] ] }, { "id": "81e46aff.74a0d8", "type": "link out", "z": "c898591b.0e6fe8", "name": "Lena Tuya in", "links": [ "4ec4c5f2.23c2dc" ], "x": 895, "y": 640, "wires": [] }, { "id": "b5006a27.98cc48", "type": "change", "z": "c898591b.0e6fe8", "name": "on", "rules": [ { "t": "set", "p": "payload.nodeid", "pt": "msg", "to": "6db05f00.c9783", "tot": "str" }, { "t": "move", "p": "bri", "pt": "msg", "to": "payload.bri", "tot": "msg" }, { "t": "move", "p": "hue", "pt": "msg", "to": "payload.hue", "tot": "msg" }, { "t": "move", "p": "sat", "pt": "msg", "to": "payload.sat", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 680, "wires": [ [ "81e46aff.74a0d8" ] ] } ]