Disclaimer

Please, proceed carefully following the tips published in this blog, specially when Main Power is involved. I'm not responsible for any damages caused by what is written in this blog.
Thank you

Wednesday, 20 February 2019

Home Automation System - Let's talk to OpenHAB...




Comando Vocale, I Comandi Vocali, Ok Google, Assistente


As I said before, I'm here to speak about my test with the vocal assistant...in particular, the setup and integration of Google Home Mini with OpenHAB.

In the previous post (see https://domoticsduino.blogspot.com/2019/01/home-automation-system-welcome-to-our.html) I spoke about my recent purchases: a Google Home Mini and a Google Chromecast. Now I'm ready to integrate them in OpenHAB in order to be able to send vocal commands to my Home Automation System items.

In OpenHAB there is a nice Google Assistant integration plugin. Its setup is easy as follow the online documentation - https://www.openhab.org/docs/ecosystem/google-assistant/

In particular, this plugin use the OpenHAB cloud connector with myOpenHAB service; these are good facilities to expose local OpenHAB installation over the internet in a secure manner; in this way OpenHAB is able to integrate external services, just like our Google Assistant.


Icona, Sociale, Networking, Presentazione, Multimedia

After the initial setup, we have to tag the items we would like to drive through Google Assistant...For this purpose we will use the OpenHAB tags, a sort of keywords used by several addons (see https://www.openhab.org/docs/configuration/items.html#tags)

Using these tags we could assign particular job to the items in the Google Home application; in fact, in order to be used with Google Assistant, our OpenHAB items must be integrated as compatible Google Home devices.

Currently these are the available tags:

"Lighting"
"Switchable"
"Scene"
"Outlet"
"CurrentTemperature"
"Thermostat"

You can check last version of this list using this url:


To assign a tag to an item we have two ways:

  • If item is defined in a text file then we could simply add the tag between square brakets [...]
  • If item is defined in PAPERUI, then you need to use REST API (see https://www.openhab.org/docs/configuration/restdocs.html); in particular this service: /items/{itemname}/tags/{tag}

Here is an example of a "lightingtag:


After finished with the tags assignment, you have to setup Google Home app, on our smartphone/tablet. You have to add a new device, choosing OpenHAB between the compatible devices list. Then you will be prompted to type your username and password to login to myOpenHAB service...Magically, all our tagged items will appear in Google Home. Let's assign a name to every device and we are able to use them with Google Assistant.

Now, we could say: Hey Google, turn the "device name" on / off

Every device could be added to a room in our virtual home, so we can group and use them with a single command


As well as sending command, we could also get devices and sensors informations. For example we could ask the room temperature.

In my example, I added the "CurrentTemperature" tag to the item related to my temperature probe in the kitchen


Google Home see it as a thermostat, so I can ask him the temperature


What if you added more tags in OpenHAB? Simply tell to Google Assistant to synchronize the devices. After some seconds, the new devices appear in Google Home.

A very interesting thing is that you can talk to Google Assistant also from the smartphone / tablet not directly connected to the local LAN where Google Home "lives". In this way you can send commands to the smartphone while you are away from home.