I found a new node for node-red which enables Google home integration very very easy and free!!.
https://flows.nodered.org/node/node-red-contrib-nora
I'm not a programmer. But i managed to get it working with MQTT in and out. So it works both ways. You just bind your google account to the node and add NORA to your google home app. Next the numbers in the switches and the "topic" in the node needs to match the domoticz IDX which you want to control.
You can add as many google assistant devices as you want. Works like a charm!!
Here is my example flow.
Code: Select all
[{"id":"4528e53.782fb1c","type":"mqtt in","z":"fd35c454.ee407","name":"","topic":"domoticz/out","qos":"2","broker":"34e4d2fc.90d346","x":70,"y":440,"wires":[["3e9a9a76.9cb2f6"]]},{"id":"3e9a9a76.9cb2f6","type":"json","z":"fd35c454.ee407","name":"","property":"payload","action":"","pretty":false,"x":230,"y":440,"wires":[["681631c8.dbc208","738ce63c.4f5c3"]]},{"id":"681631c8.dbc208","type":"switch","z":"fd35c454.ee407","name":"","property":"payload.switchType","propertyType":"msg","rules":[{"t":"cont","v":"On/Off","vt":"str"},{"t":"eq","v":"Dimmer","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":440,"wires":[["f9798848.30054"],["e3793bc5.9aa94"]]},{"id":"f9798848.30054","type":"function","z":"fd35c454.ee407","name":"Function In on/off","func":"msg.topic = msg.payload.idx\nif (msg.payload.nvalue == 1)\n{\n msg.payload = true\n}\nelse if (msg.payload.nvalue === 0)\n{\n msg.payload = false\n}\n return msg;\n","outputs":1,"noerr":0,"x":550,"y":380,"wires":[["c7d42d19.b2e198"]]},{"id":"e3793bc5.9aa94","type":"function","z":"fd35c454.ee407","name":"Function Dimmer","func":"msg.topic = msg.payload.idx\nvar brightness = msg.payload.svalue1\nif (msg.payload.nvalue === 1)\n{\n msg.payload = 100\n}\nelse if (msg.payload.nvalue === 0)\n{\n msg.payload = 0\n}\nelse if (msg.payload.nvalue === 2)\n{\n msg.payload = brightness\n}\n return msg;\n\n","outputs":1,"noerr":0,"x":550,"y":480,"wires":[["b8c784d7.203388"]]},{"id":"c7d42d19.b2e198","type":"switch","z":"fd35c454.ee407","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"158","vt":"str"},{"t":"eq","v":"168","vt":"str"},{"t":"eq","v":"620","vt":"str"},{"t":"eq","v":"176","vt":"str"},{"t":"eq","v":"365","vt":"str"},{"t":"eq","v":"482","vt":"str"},{"t":"eq","v":"349","vt":"str"},{"t":"eq","v":"530","vt":"str"},{"t":"eq","v":"336","vt":"str"}],"checkall":"true","repair":false,"outputs":9,"x":750,"y":260,"wires":[["2829642d.fb748c"],["9a731c14.437d5"],["3e545d4c.299352"],["39746777.4cd46"],["72282919.51404"],["ff689805.dc7098"],["160ad1c9.3c1426"],["b1ca6005.2e93f"],["d100ba7b.ea6938"]]},{"id":"b8c784d7.203388","type":"switch","z":"fd35c454.ee407","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"113","vt":"str"},{"t":"eq","v":"516","vt":"str"},{"t":"eq","v":"92","vt":"str"},{"t":"eq","v":"144","vt":"str"},{"t":"eq","v":"610","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":750,"y":800,"wires":[["257f1795.0e50f8"],["dba00889.f2775"],["c67e2421.cbd0d"],["c9ac25c4.1eaaf"],["e7f419af.b6062"]]},{"id":"257f1795.0e50f8","type":"nora-light","z":"fd35c454.ee407","devicename":"Keuken","lightcolor":false,"brightnesscontrol":true,"passthru":false,"statepayload":false,"brightnessoverride":"100","roomhint":"Keuken","name":"Keuken","nora":"48bacfcb.9887b8","topic":"113","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":920,"y":780,"wires":[["a1c7a6cf.d4bcb"]]},{"id":"39746777.4cd46","type":"nora-switch","z":"fd35c454.ee407","devicename":"het Haardvuur","roomhint":"Woonkamer","name":"Haardvuur","passthru":false,"nora":"48bacfcb.9887b8","topic":"176","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":930,"y":300,"wires":[["805526ff.cf4d08"]]},{"id":"805526ff.cf4d08","type":"function","z":"fd35c454.ee407","name":"Function out On/Off","func":"var idx = parseInt(msg.topic);\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nelse if ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\nreturn msg\n","outputs":1,"noerr":0,"x":1380,"y":280,"wires":[["7d584545.8c9544"]]},{"id":"a1c7a6cf.d4bcb","type":"function","z":"fd35c454.ee407","name":"Function out Dimmer","func":"var idx = parseInt(msg.topic)\nvar brightness = msg.payload\nif ( msg.payload === 0 )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\nreturn [msg, null]\n}\nelse\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Set Level\", \"level\": brightness };\nreturn [null, msg]\n}\n\n\n","outputs":2,"noerr":0,"x":1300,"y":700,"wires":[["7d584545.8c9544"],["7d584545.8c9544"]]},{"id":"55a04197.0e6f9","type":"nora-scene","z":"fd35c454.ee407","devicename":"beveiliging","roomhint":"","scenereversible":true,"name":"beveiliging","nora":"48bacfcb.9887b8","topic":"5","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":920,"y":1180,"wires":[["e63a5889.fbb5b8"]]},{"id":"e63a5889.fbb5b8","type":"function","z":"fd35c454.ee407","name":"Function Scene","func":"var idx = parseInt(msg.topic)\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchscene\", \"idx\": idx, \"switchcmd\": \"On\" };\nreturn msg\n}\n\n","outputs":1,"noerr":0,"x":1320,"y":820,"wires":[["7d584545.8c9544"]]},{"id":"7d584545.8c9544","type":"json","z":"fd35c454.ee407","name":"","property":"payload","action":"","pretty":false,"x":1630,"y":580,"wires":[["caefbcc2.78bf18"]]},{"id":"caefbcc2.78bf18","type":"mqtt out","z":"fd35c454.ee407","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"34e4d2fc.90d346","x":1870,"y":580,"wires":[]},{"id":"34e4d2fc.90d346","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"48bacfcb.9887b8","type":"nora-config","z":"","name":"nora config","group":""}]