FREE Domoticz to Google Home without opening ports using OpenHAB without MQTT
Posted: Wednesday 23 January 2019 21:23
Got a FREE solution to simply flow data from Domoticz to Google Home without using MQTT
This is one-direction solution, from Google back to Domoticz is also possible with some additional coding
I only needed to publish a very limited set of domoticz devices and could also add some in OpenHAB itself. I found MQTT a nightmare to setup in OpenHAB so I used Node-Red
Domoticz --> Node-Red --> OpenHAB --> OpenHAB Cloud --> Google Home
OpenHAB
Install OpenHAB either on seperate RPI or Synology docker.
Enable and configure OpenHAB Cloud
Create new Item for a Domoticz device of choice
Use the OpenHAB console (https://www.openhab.org/docs/administra ... nsole.html) to set tag to the item (https://www.openhab.org/docs/ecosystem/ ... assistant/) with the following command: smarthome:items addTag [New OpenHAB Item] Lighting
Check the google assistant page for more types of tags to use
Node-Red
Install node-red-contrib-openhab2 in Node-Red
Import the following flow in Node-Red and change
* msg.payload.name = "[Domoticz Device Name]" or use msg.payload.idx in OpenHAB function
* Change OpenHAB server settings in OH (I had to deploy and refresh Node_red at this stage)
* select Item created in OpenHAB to link to in OH: OpenHAB connector
[{"id":"4111ec12.85c6b4","type":"openhab-v2-out","z":"2e382d88.a37b72","name":"OH","controller":"bfc94f2e.75fe3","item":"NewItem","topic":"ItemUpdate","topicType":"oh_cmd","payload":"payload","payloadType":"msg","storeStateInFlow":false,"x":710,"y":300,"wires":[]},{"id":"fbe5ef9c.cda38","type":"function","z":"2e382d88.a37b72","name":"OpenHAB","func":"/* msg.payload.idx.toString();\nmsg.payload.id;\nmsg.payload.name;\nmsg.payload.dtype;\nmsg.payload.Battery;\nmsg.payload.RSSI;\nmsg.payload.nvalue;\nmsg.payload.stype;\nmsg.payload.unit;\n*/\nif (msg.payload.name == \"Nefit kamertemperatuur\") {\n msg.payload=msg.payload.svalue1; }\n else {\n return null;}\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":300,"wires":[["4111ec12.85c6b4"]]},{"id":"b2174b1e.3cf228","type":"json","z":"2e382d88.a37b72","name":"","x":330,"y":300,"wires":[["fbe5ef9c.cda38"]]},{"id":"87967ad0.a72ba8","type":"mqtt in","z":"2e382d88.a37b72","name":"Domotic Out","topic":"domoticz/out","qos":"2","broker":"6975ece5.0dc684","x":130,"y":300,"wires":[["b2174b1e.3cf228"]]},{"id":"bfc94f2e.75fe3","type":"openhab-v2-controller","z":0,"name":"OpenHab Synology","protocol":"http","host":"192.168.178.21","port":"32847","path":"","username":"","password":"","allowRawEvents":true},{"id":"6975ece5.0dc684","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":"","willTopic":"","willQos":"0","willRetain":null,"willPayload":""}]
OpenHAB Cloud
Check that items created are visible in OpenHAB Cloud
Google Assistant
Link google assistant to OpenHAB Cloud and select the items available in OpenHAB cloud to be visible in Google Assistant
Change flow in Node-Red and add items if you want to add more.
DONE
This is one-direction solution, from Google back to Domoticz is also possible with some additional coding
I only needed to publish a very limited set of domoticz devices and could also add some in OpenHAB itself. I found MQTT a nightmare to setup in OpenHAB so I used Node-Red
Domoticz --> Node-Red --> OpenHAB --> OpenHAB Cloud --> Google Home
OpenHAB
Install OpenHAB either on seperate RPI or Synology docker.
Enable and configure OpenHAB Cloud
Create new Item for a Domoticz device of choice
Use the OpenHAB console (https://www.openhab.org/docs/administra ... nsole.html) to set tag to the item (https://www.openhab.org/docs/ecosystem/ ... assistant/) with the following command: smarthome:items addTag [New OpenHAB Item] Lighting
Check the google assistant page for more types of tags to use
Node-Red
Install node-red-contrib-openhab2 in Node-Red
Import the following flow in Node-Red and change
* msg.payload.name = "[Domoticz Device Name]" or use msg.payload.idx in OpenHAB function
* Change OpenHAB server settings in OH (I had to deploy and refresh Node_red at this stage)
* select Item created in OpenHAB to link to in OH: OpenHAB connector
[{"id":"4111ec12.85c6b4","type":"openhab-v2-out","z":"2e382d88.a37b72","name":"OH","controller":"bfc94f2e.75fe3","item":"NewItem","topic":"ItemUpdate","topicType":"oh_cmd","payload":"payload","payloadType":"msg","storeStateInFlow":false,"x":710,"y":300,"wires":[]},{"id":"fbe5ef9c.cda38","type":"function","z":"2e382d88.a37b72","name":"OpenHAB","func":"/* msg.payload.idx.toString();\nmsg.payload.id;\nmsg.payload.name;\nmsg.payload.dtype;\nmsg.payload.Battery;\nmsg.payload.RSSI;\nmsg.payload.nvalue;\nmsg.payload.stype;\nmsg.payload.unit;\n*/\nif (msg.payload.name == \"Nefit kamertemperatuur\") {\n msg.payload=msg.payload.svalue1; }\n else {\n return null;}\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":300,"wires":[["4111ec12.85c6b4"]]},{"id":"b2174b1e.3cf228","type":"json","z":"2e382d88.a37b72","name":"","x":330,"y":300,"wires":[["fbe5ef9c.cda38"]]},{"id":"87967ad0.a72ba8","type":"mqtt in","z":"2e382d88.a37b72","name":"Domotic Out","topic":"domoticz/out","qos":"2","broker":"6975ece5.0dc684","x":130,"y":300,"wires":[["b2174b1e.3cf228"]]},{"id":"bfc94f2e.75fe3","type":"openhab-v2-controller","z":0,"name":"OpenHab Synology","protocol":"http","host":"192.168.178.21","port":"32847","path":"","username":"","password":"","allowRawEvents":true},{"id":"6975ece5.0dc684","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":"","willTopic":"","willQos":"0","willRetain":null,"willPayload":""}]
OpenHAB Cloud
Check that items created are visible in OpenHAB Cloud
Google Assistant
Link google assistant to OpenHAB Cloud and select the items available in OpenHAB cloud to be visible in Google Assistant
Change flow in Node-Red and add items if you want to add more.
DONE