Page 1 of 1

FREE Domoticz to Google Home without opening ports using OpenHAB without MQTT

Posted: Wednesday 23 January 2019 21:23
by epke
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

Re: FREE Domoticz to Google Home without opening ports using OpenHAB without MQTT

Posted: Thursday 07 November 2019 11:44
by Gravityz
hello,

i am trying your example but can not get it to work

have domoticz working
made a virtual switch called test

have openhab working
made an item switchlight called test

imported your flow
changed the payload name to [test]

when i flip the test switch in domoticz i do not see it flip in openhab

i suspect i need to do something more but am not familiar with nodered
flow.JPG
flow.JPG (66.62 KiB) Viewed 2098 times
this is in the OpenHab function
function.JPG
function.JPG (27.41 KiB) Viewed 2098 times
i also have MQTT working(from domoticz-to openhab) but the whole idea is that i use nodered instead so i can use it bidirectional

Re: FREE Domoticz to Google Home without opening ports using OpenHAB without MQTT

Posted: Monday 06 January 2020 17:16
by Gravityz
solved