Since Controliz is now a paid subscription, i decided to take onother route and create my simple alternartive version, that is in no way is up to par with Controliz but it is working pretty well for what I need.
So I have created an flow on node red and is using ifttt as the integration with google home.
For this to work you´ll need:
1) Expose node red on public web, and if your IPs is dynamic, an Dynamic DNS (please, read this for security reasons: https://github.com/node-red/cookbook.no ... e-Internet)
2) Create 2 applets on ifttt
2.1) Google Assistant --> Voice command "Turn on $" and "OK" as response --> Web Hook --> url: "https://<<your public ip/name/dynamic dns>>/ghome?cmd=on&device={{TextField}}"
2.2) Google Assistant --> Voice command "Turn off $" and "OK" as response --> Web Hook --> url: "https://<<your public ip/name/dynamic dns>>/ghome?cmd=off&device={{TextField}}"
3) Add this to node red pallet: node-red-contrib-filter, node-red-contrib-splitter and node-red-contrib-google-home-notify
3) Import the flow attached
4) Adjust as desired the variable on the node "Flow Variables":
4.1) domoticzServer: IP/hostame of the Domoticz Server
4.2) domoticzPort: Web port of the Domoticz Server
4.3) domoticzLogin: A user in Domoticz
4.4) domoticzPassword: Password for the user above
4.5) voiceOnCmd: Frase to say when Turning on the device <Ex: Turning on ...., Ligando ...>
4.6) voiceOffCmd: Frase to say when Turning off the device <Ex: Turning off ...., Ligando ...>
4.7) voiceDeviceBegin: Frase to say on the beggining when the device is not recognized <Ex: Device ..... 'voiceDeviceEnd'>
4.8) voiceDeviceEnd: Frase to say on the end when the device is not recognized <Ex: 'voiceDeviceBegin' ..... Not Recognized>
5) Edit the node "domoticz/in" and adjust your ip of your mqtt server
6) Edit the node "Google Home Notify" and use the IP address of your Google Home
7) Now edit each device on Domoticz and on Description use something like this:
;ghome:<word 1>,<word 2>,<word 3>,....,<word 99>; (Do no use spaces between commas)
ex: Kithchen Light --> ;ghome:kitchen;
My bedroom Light --> ;ghome:my bedroom,my room;
Garden Light --> ;ghome:Garden Lights;
Rules:
7.1) Do not use the same word one more than one device
Ex: My bedroom Light --> ;ghome:bedroom,my room,my bedroom;
Chliderns bedroom Light --> ;ghome:Chliderns bedroom;
In the case above, the word bedroom appear on both devices, so if you say "Hey google, Turn on Bedroom", It will turn on the two lights, Because "bedroom" exists on "Chliderns bedroom";
7.2) Always try to use specific words to describe the device, so in the case above, the right way is:
Ex: My bedroom Light --> ;ghome:my room,my bedroom;
Chliderns bedroom Light --> ;ghome:Chliderns bedroom;
So, this is the alfa Version 0.00000000001. Bugs will appear, probably a lot of them...
Help is apreciated.
To do list:
1) Add secutity to the call between ifttt and node red url webhook;
2) Better word detection
3) Better Google Home integration without the need of ifttt
4) ????????? Help....
Sorry for my bad english, I´m Brazilian
Import this on node red
Code: Select all
[{"id":"c912b393.34004","type":"tab","label":"Domoticz Google Home","disabled":false,"info":""},{"id":"9bce9ee0.0ac6b","type":"http response","z":"c912b393.34004","name":"","statusCode":"","headers":{},"x":630,"y":480,"wires":[]},{"id":"21aef424.ca2ffc","type":"http in","z":"c912b393.34004","name":"","url":"/ghome","method":"get","upload":false,"swaggerDoc":"","x":150,"y":540,"wires":[["b85f0027.ba98e","c4d8dfb4.10fb7"]]},{"id":"b85f0027.ba98e","type":"template","z":"c912b393.34004","name":"Simple response","field":"payload","fieldType":"msg","format":"html","syntax":"plain","template":"Ok","x":430,"y":480,"wires":[["9bce9ee0.0ac6b"]]},{"id":"c4d8dfb4.10fb7","type":"function","z":"c912b393.34004","name":"Read Dictionare","func":"var cmd = msg.payload.cmd\ncmd = cmd.toLowerCase();\nvar device = msg.payload.device;\ndevice = device.toLowerCase();\nwords = flow.get('words');\nvar idx = 0;\nvar voicecmd;\nif (cmd === \"on\")\n{\n cmd = 1;\n voicecmd = flow.get('voiceOnCmd');\n}\nelse if (cmd === \"off\")\n{\n cmd = 0;\n voicecmd = flow.get('voiceOffCmd');\n}\nif (cmd === 1 || cmd === 0 )\n{\n for (i = 0; i < words.length; i++)\n {\n var word = words[i].split(\":\");\n if (device.indexOf(word[0]) > -1)\n {\n idx = word[1];\n name = word[2];\n }\n }\n if (idx !== 0)\n {\n msg.payload = '{\"idx\":' + idx + ',\"nvalue\":' + cmd + ',\"svalue\":\"\"}';\n var msg2 = { payload:\"\" };\n msg2.payload = voicecmd + \" \" + name;\n return [ msg, msg2];\n }\n else\n {\n msg.payload = flow.get('voiceDeviceBegin') + ' ' + device + ' ' + flow.get('voiceDeviceEnd');\n return [ null, msg];\n }\n}","outputs":2,"noerr":0,"x":420,"y":600,"wires":[["3d00d6b6.3cb84a"],["26102169.1fc89e"]]},{"id":"3d00d6b6.3cb84a","type":"mqtt out","z":"c912b393.34004","name":"","topic":"domoticz/in","qos":"0","retain":"false","broker":"f52a5e5a.a2be4","x":650,"y":560,"wires":[]},{"id":"4e5aa7a5.f6e1e8","type":"inject","z":"c912b393.34004","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"onceDelay":"1","x":130,"y":160,"wires":[["ea87fd01.125c3"]]},{"id":"ee4d95a4.da2a08","type":"change","z":"c912b393.34004","name":"","rules":[{"t":"delete","p":"responseUrl","pt":"msg"},{"t":"delete","p":"headers","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":160,"wires":[["84c00300.5edff"]]},{"id":"84c00300.5edff","type":"splitter","z":"c912b393.34004","name":"","property":"payload.result","x":890,"y":160,"wires":[["6c0c3262.814a3c"]]},{"id":"6c0c3262.814a3c","type":"filter","z":"c912b393.34004","name":"","property":"payload.Description","propertyType":"msg","asArray":false,"itemProperty":"payload","itemPropertyType":"item","rules":[{"t":"cont","v":"ghome:","vt":"str","output":1}],"checkall":"true","outputs":1,"x":1010,"y":160,"wires":[["cf4a4597.950788"]]},{"id":"cf4a4597.950788","type":"change","z":"c912b393.34004","name":"","rules":[{"t":"delete","p":"payload_unsplit","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":300,"wires":[["358aace.3cd7654"]]},{"id":"358aace.3cd7654","type":"function","z":"c912b393.34004","name":"Idx to word","func":"var description = msg.payload.Description;\nvar ghome;\nvar words = new Array();\ndescription = description.split(\";\");\nfor (i = 0; i < description.length; i++) \n{ \n var option = description[i];\n if (option.indexOf('ghome') > -1)\n {\n msg.idx = msg.payload.idx;\n msg.name = msg.payload.Name;\n option = option.split(\":\");\n ghome = option[1]\n ghome = ghome.split(\",\");\n for (j = 0; j< ghome.length; j++)\n {\n var line = ghome[j] + \":\" + msg.idx + \":\" + msg.name;\n line = line.toLowerCase();\n words.push(line);\n }\n msg.words = words;\n msg.ghome = ghome;\n return msg;\n }\n}","outputs":1,"noerr":0,"x":470,"y":300,"wires":[["477f2b7c.41f184"]]},{"id":"477f2b7c.41f184","type":"join","z":"c912b393.34004","name":"","mode":"custom","build":"string","property":"words","propertyType":"msg","key":"idx","joiner":",","joinerType":"str","accumulate":false,"timeout":"10","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":300,"wires":[["da510cfa.33f45"]]},{"id":"da510cfa.33f45","type":"function","z":"c912b393.34004","name":"Create Dictionare","func":"words = msg.words\nwords = words.split(\",\");\nflow.set('words',words);\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":300,"wires":[[]]},{"id":"26102169.1fc89e","type":"googlehome-notify","z":"c912b393.34004","server":"a47505a0.d18cb8","name":"","x":680,"y":640,"wires":[]},{"id":"ea87fd01.125c3","type":"change","z":"c912b393.34004","name":"Flow Variables","rules":[{"t":"set","p":"domoticzServer","pt":"flow","to":"localhost","tot":"str"},{"t":"set","p":"domoticzPort","pt":"flow","to":"80","tot":"num"},{"t":"set","p":"domoticzLogin","pt":"flow","to":"","tot":"str"},{"t":"set","p":"domoticzPassword","pt":"flow","to":"","tot":"str"},{"t":"set","p":"voiceOnCmd","pt":"flow","to":"Turning On","tot":"str"},{"t":"set","p":"voiceOffCmd","pt":"flow","to":"Turning Off","tot":"str"},{"t":"set","p":"voiceDeviceBegin","pt":"flow","to":"device","tot":"str"},{"t":"set","p":"voiceDeviceEnd","pt":"flow","to":"not recognized","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":40,"wires":[["c5398e08.fafe6"]]},{"id":"668e7ea1.4792f","type":"http request","z":"c912b393.34004","name":"","method":"GET","ret":"obj","url":"","tls":"","x":550,"y":160,"wires":[["ee4d95a4.da2a08"]]},{"id":"c5398e08.fafe6","type":"function","z":"c912b393.34004","name":"url create","func":"domoticzLogin = flow.get('domoticzLogin');\ndomoticzPassword = flow.get('domoticzPassword');\ndomoticzServer = flow.get('domoticzServer');\ndomoticzPort = flow.get('domoticzPort');\nif (domoticzLogin === '' || domoticzPassword === '')\n{\n msg.url = 'http://' + domoticzServer + ':' + domoticzPort + '/json.htm?type=devices&filter=light&used=true';\n}\nelse\n{\n msg.url = 'http://' + domoticzLogin + ':' + domoticzPassword + '@' + domoticzServer + ':' + domoticzPort + '/json.htm?type=devices&filter=light&used=true';\n}\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":160,"wires":[["668e7ea1.4792f"]]},{"id":"f52a5e5a.a2be4","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"30","cleansession":true,"birthTopic":"/nodered/connected","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"/nodered/disconnected","willQos":"0","willPayload":""},{"id":"a47505a0.d18cb8","type":"googlehome-config-node","z":"","ipaddress":"192.168.25.171","language":"pt"}]