Moving to OpenHAB to get Google Home support for free?
Moderator: leecollings
-
- Posts: 23
- Joined: Wednesday 22 March 2017 22:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Nice work Ankan.
Works great, no need for ha-bridge anymore, just link openhab skill and get all the switches, lights & thermostats working on alexa as well as GH.
Had to do some tweaking on some rules for the dimmer lights and blinds, but all good.
Thanks for sharing.
Works great, no need for ha-bridge anymore, just link openhab skill and get all the switches, lights & thermostats working on alexa as well as GH.
Had to do some tweaking on some rules for the dimmer lights and blinds, but all good.
Thanks for sharing.
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I'am glad it helped you.
Please share your tweaks if it's something that would make it even better.
Please share your tweaks if it's something that would make it even better.
-
- Posts: 23
- Joined: Wednesday 22 March 2017 22:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I have some of my dimmers in different groups (gDimmers1) ect.. as they require calcs to output correctly.
For instance when my LWRF dimmer is at 30% on GH dial, it is at 100% brightness in dom. so just convert the string into a DecimalType and divide by 3.
Simple but effective.
For instance when my LWRF dimmer is at 30% on GH dial, it is at 100% brightness in dom. so just convert the string into a DecimalType and divide by 3.
Code: Select all
rule "Send MQTT message on Dimmer command"
when
Member of gDimmer received command
then
var idxStartPos = triggeringItem.name.indexOf("idx") + 3
var idxStopPos = triggeringItem.name.length()
var adjust = triggeringItem.state as DecimalType
var adjusted = adjust / 3
var myString = ""
{
myString = '{\"command\": \"switchlight\", \"idx\": ' + triggeringItem.name.substring(idxStartPos,idxStopPos) + ', \"switchcmd\": \"Set Level\", \"level\": ' + adjusted + '}'
}
publish("mosquitto", "domoticz/in", myString)
end
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
This seem to be a great way to use Google Home on domoticz.Ankan wrote: ↑Thursday 06 December 2018 22:21 Okey, it's up and running. Let's see if it's possible to make it even better.
* Had Domoticz running on RPi at port 8080 (and 443)
1. Installed Mosquitto and configured Domoticz to connect to it
2. Installed zulu java for embedded as it wasn't installed in the Domoticz image
3. Installed OpenHAB and change port to 8081. After installation I had to wait 10-15 minutes before it was up and running and listening at port.
4. Installed following OpenHAB addons:
- MQTT binding
- MQTT Actions
- JSONPath, Map, Javascript and RegEx Transformation
- openHAB Cloud Connector
5. Configure MQTT binding
6. Configured rules, items and javascript as below
7. Configured openHAB Cloud Connector
8. Now, I can control my domoticz devices with my Google Home and ask for temperature. If I want I can use the openHAB webinterface as they sync with each other. I can do stuff via myopenHAB if I want to. And everything without open any ports in my firewall.
I will only add domoticz items in openHAB that I think is secure to let Google Home to have control over.
So this is how I solved it and it works for me. I would prefer to not enter idx number two times on same row in items-file, but I couldn't solve it any other way.
Items:123 and 124 is device idx in Domoticz. mqttBroker is what I configured the mqtt-connection to be called in mqtt binding.Code: Select all
Switch idx123 "Outdoorlamp" (gLight) [ "Lighting" ] {mqtt="<[mqttBroker:domoticz/out:state:JS(get_state.js):(?s).*idx\".?.?.?123,.*]"} Number Outdoor_Temperature "Temperature [%.1f]" <temperature> ["CurrentTemperature"] {mqtt="<[mqttBroker:domoticz/out:state:JSONPATH($.svalue1):(?s).*idx\".?.?.?124,.*]"}
Rules:get_state.jsCode: Select all
rule "Send MQTT message on Light command" when Member of gLight received command then var idxStartPos = triggeringItem.name.indexOf("idx") + 3 var idxStopPos = triggeringItem.name.length() var myString = "" if (triggeringItem.state.toString() == "ON" || triggeringItem.state.toString() == "OFF") { var cmd = triggeringItem.state.toString().toLowerCase.toFirstUpper() // {"command": "switchlight", "idx": 2450, "switchcmd": "On" } myString = '{\"command\": \"switchlight\", \"idx\": ' + triggeringItem.name.substring(idxStartPos,idxStopPos) + ', \"switchcmd\": \"' + cmd + '\"}' } else { // {"command": "switchlight", "idx": 2450, "switchcmd": "Set Level", "level": 100 } myString = '{\"command\": \"switchlight\", \"idx\": ' + triggeringItem.name.substring(idxStartPos,idxStopPos) + ', \"switchcmd\": \"Set Level\", \"level\": ' + triggeringItem.state.toString() + '}' } publish("mqttBroker", "domoticz/in", myString) end
Code: Select all
(function(i){ var parsed = JSON.parse(i); if (parsed.nvalue == 0) { return "OFF" } else if (parsed.nvalue == 1) { return "ON" } else if (parsed.nvalue == 2) { return parsed.svalue1 } })(input);
But I'm not so familiar with OpenHab.
Do you think you can explain a bit more detailed how to setup OpenHab from scratch?
I have managed to install OpenHab docker image and installed the addons but then I'm lost:)
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I guess best and easiest way would be to use the openHABian image on your raspberry and install Domoticz on that.
I used the Domoticz RPi image and installed OpenHAB by this guide: https://www.openhab.org/docs/installation/linux.html
but it's not that easy.
If you want to run OpenHAB on Windows computer, you just download binary and run start.bat. Thats all. Then it's up and running at port 8080 by default.
I haven't used docker image so I can't help you there. Maybe I should have started there, but I didn't.
I used the Domoticz RPi image and installed OpenHAB by this guide: https://www.openhab.org/docs/installation/linux.html
but it's not that easy.
If you want to run OpenHAB on Windows computer, you just download binary and run start.bat. Thats all. Then it's up and running at port 8080 by default.
I haven't used docker image so I can't help you there. Maybe I should have started there, but I didn't.
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Where do I put get_state.js?
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
In the Transformation folder.
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I cant get the MQTT to work.
I have install MQTT binding & actions
I have updated mqtt.conf with my mosquitto server ip.
Is there anything else I have to configure to get MQTT to work?
I have install MQTT binding & actions
I have updated mqtt.conf with my mosquitto server ip.
Is there anything else I have to configure to get MQTT to work?
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Use MQTT.fx to check if MQTT server is up and running correct and se if you get any messages from Domoticz or OpenHAB.
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
The mosquitto server is working with domoticz. But I cant get it to work with OpenHab. OpenHab doesent publish anything when I flip a switch.
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Then it's something about the rule. Did you save the rule file in the rules folder with the extension xxxxxx.rules ?
Then check if you used same groupname in extension and on device. In my example gLight.
The rule only works if you use the name format idx123 where 123 is your device idx number in dometicz.
Then check if you used same groupname in extension and on device. In my example gLight.
The rule only works if you use the name format idx123 where 123 is your device idx number in dometicz.
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I found the problem. It was a bug in OpenHab. To get MQTT to work I had to uninstall MQTT Action and then install it again.
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Great you found it. So now it's up and running?
-
- Posts: 60
- Joined: Thursday 20 April 2017 7:20
- Target OS: Linux
- Domoticz version: Latest
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Yes, it's working now.
Thank you for your help.
Thank you for your help.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
This looks promissing, let me check if I can setup the thing on a docker within Synology. tnx for sharing.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 48
- Joined: Thursday 09 November 2017 20:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I have noticed that openhab 2.4 have a new mqtt binding that works totally different. Be sure you install the old binding if you want to follow my setup.
https://www.openhab.org/blog/2018-12-16 ... cture.html
https://www.openhab.org/blog/2018-12-16 ... cture.html
-
- Posts: 5
- Joined: Saturday 24 February 2018 10:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
Is Google assistant able to process Dutch commands for openhab?
Verstuurd vanaf mijn ZTE A2017G met Tapatalk
Verstuurd vanaf mijn ZTE A2017G met Tapatalk
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
I second that Looking for something like OpenHAB for dummies or something like thatressof wrote: ↑Tuesday 11 December 2018 8:10
This seem to be a great way to use Google Home on domoticz.
But I'm not so familiar with OpenHab.
Do you think you can explain a bit more detailed how to setup OpenHab from scratch?
I have managed to install OpenHab docker image and installed the addons but then I'm lost:)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Moving to OpenHAB to get Google Home support for free?
+1EdwinK wrote: ↑Thursday 03 January 2019 10:24I second that Looking for something like OpenHAB for dummies or something like thatressof wrote: ↑Tuesday 11 December 2018 8:10
This seem to be a great way to use Google Home on domoticz.
But I'm not so familiar with OpenHab.
Do you think you can explain a bit more detailed how to setup OpenHab from scratch?
I have managed to install OpenHab docker image and installed the addons but then I'm lost:)
Have it installed on the Synology in docker.
But this is a total new world for me.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Who is online
Users browsing this forum: No registered users and 1 guest