Official Google Assistant Integration for openHAB

I’m guessing that “mode” is the tag we insert into the item to identify the item to Google. I should have realized that humidity isn’t one of them (same as for your blinds), so it probably won’t work at this time.

No idea why your Home Hub doesn’t show temp when your phone will, but I don’t think it’s an OH issue.

It’s discussed some in the docs. To get the humidity you need to create all the Items necessary for a thermostat, including an Item for the Mode.

See the docs for an example. I use the following Item set for each of my sensors:

Group vBasement_Thermostat "Basement" [ "Thermostat" ]

String vBasement_Mode "Basement Heating Mode [%s]"
    (vBasement_Thermostat)

Number:Temperature vBasement_Temperature  "Basement Temperature [%.0f °F]"
    <temperature> (gChart, gIndoorTemps, gResetExpire, gMaxTemp, vBasement_Thermostat, LowerFloorsTemps)  [ "CurrentTemperature" ]
    { channel="mqtt:topic:basement-sensors:temperature", expire="2m,state=UNDEF" }

Number:Dimensionless vBasement_Humidity     "Basement Humidity [%.0f%%]"
    <humidity> (gChart, gIndoorHumidity, gResetExpire, vBasement_Thermostat) [ "CurrentHumidity" ]
    { channel="mqtt:topic:basement-sensors:humidity", expire="2m,state=UNDEF"}

Switch vBasement_Humidity_Alerted
    (gResetExpire)
    {expire="24h,command=OFF"}

Number:Temperature vBasement_Target_Temp "Basement Target Temp [%.0f °F]"
    <temperature> (vBasement_Temperature) [ "TargetTemperature" ]

I just tested it and it worked.

1 Like

As I also read the docs I created all items. But instead of “Numbers” my values are “Strings”. Maybe that’s the problem (although it works for temperature!?).
Just one additional question: did you declare “vBasement_Mode” somewhere else, maybe in a rule? Or is this string empty?

You only ever define Items in .items files or through PaperUI. Since the above is an extract of text based configs it naturally comes from a .items file.

The example Items in the docs are all Numbers. Usually the types of Items matter, a lot. So I would expect you need to use Number Items as are used in the example. The Mode appears to work OK as a String, but I don’t actually use this Item for anything. It only exists so that Google Assistant doesn’t complain.

Cool, I’ll have to try that. I think I got everything I needed from this thread, so it never occurred to me that there was documentation for GA. :wink:

@All,

the google assistant is now updated and I deployed a new version to support Rollershutter and Open/Close trait. Thanks to https://github.com/pythen for the contribution.

The initial post in this thread is updated with example commands for Rollershutters/Blinds and the needed Tag. Please test it and let me know if there is something unexpected from your side.
It worked in my tests fine (but I dont have a real device).

Regarding new Traits/DeviceTypes: I think it should be no problem to add them.
Currently I want to introduce a CI/CD Pipeline, so the release can be easily done.

Who ever wants to support with development power in the openhab-google-assistant project,
please feel free to join the train. Your help will be appreciated.

Thanks & BR
Mehmet

6 Likes

I’ve tested it, but I have some problems. The command via the Google Assistant returns inverted percentage values.

Here is an example:

If I press the button “Up” in the BasicUI, the value of the shutter changes to 0%.

2019-05-17 12:06:31.051 [ome.event.ItemCommandEvent] - Item 'Somfy_Tuer_Balkon' received command UP
2019-05-17 12:06:31.078 [vent.ItemStateChangedEvent] - Somfy_Tuer_Balkon changed from 100 to 0

However, when I say the command to Google “Roller shutter balcony up” or “Roller shutter balcony open”, the value changes to 100%.

2019-05-17 12:08:11.897 [ome.event.ItemCommandEvent] - Item 'Somfy_Tuer_Balkon' received command 100
2019-05-17 12:08:11.925 [vent.ItemStateChangedEvent] - Somfy_Tuer_Balkon changed from 0 to 100

So it’s the exact reverse.

I think it should be like this:
0% = open/up
100% = closed/down

I’m observing the same behavior - the blinds open on command “close the blinds”.

I have basically the same, and I think it is related to the “Invert control” and/or the “Invert percentage value”.
For the sunscreen in my garden I want the screen to extend when I say open, and then it goes to 100 percent (100 percent open). Therefore I have this one set to invert the control, not the percentage value
There opening and closing via Google home gives the desired value and the desired behaviour.

For the Rollershutters in front of the windows, I want the shutters to open as in that I can see through my window, and then it goes to 0% extended. Therefore I have set this one to invert the percentage, not the control.
Here I however have to say close to open it and open to close it…

So to me it seems that the Google home implementation does not take that into account.

There is no example for the open/close trait in the initial post. Does it only work with blinds?
It would have been great to have it with windows as well as doors (automatic doors like garagedoors. Ie switchable devices)) as well.

Uh no, like anything discussed in this topic, it works with anything that you give a Blinds tag to.

Hi,

we have a problem with Inversion of commands. It is known and we try to fix it asap. Sorry for that.

BR Mehmet

Hi,
Does anybody have an example of a full working thermostat? I have this:

Group g_Thermostat "Thermostat" [ "Thermostat" ]
String ThermostatMode "Thermostat mode" (g_Thermostat) [ "homekit:HeatingCoolingMode" ]
Number ThermostatCurrentTemperature "Thermostat current temperature" (g_Thermostat) [ "CurrentTemperature" ]
Number ThermostatHumidity "Thermostat humedity" (g_Thermostat) [ "CurrentHumidity" ]
Number ThermostatTargetTemperature "Thermostat target temperature" (g_Thermostat) [ "TargetTemperature" ]

But after re-syncing devices in Google Assistant, Thermostat always appears as offline in Google Home.
If I comment out the mode:

Group g_Thermostat "Thermostat" [ "Thermostat" ]
//String ThermostatMode "Thermostat mode" (g_Thermostat) [ "homekit:HeatingCoolingMode" ]
Number ThermostatCurrentTemperature "Thermostat current temperature" (g_Thermostat) [ "CurrentTemperature" ]
Number ThermostatHumidity "Thermostat humedity" (g_Thermostat) [ "CurrentHumidity" ]
Number ThermostatTargetTemperature "Thermostat target temperature" (g_Thermostat) [ "TargetTemperature" ]

After I re-sync, the thermostat appears online, but, obviously, the mode doesn’t work. Also, there is no trace of the humidity.
What am I doing wrong?
Thanks.

But doesnt blinds assume it´s a “dimmer” type?? (0-100%)
I havn´t tried, but I would suspect the icon in google home would be a blind as well.

No, it is a blinds/rollershutter type. Or an OpenClose trait in Google action terms.
Icon is indeed looking like blinds

Just added the tags to my windows (Velux). They appear as blinds on Google home, but I can not controle them at all from the Google Home app… Why is that?

Rollershutter Vindue01 "Vindue stue syd-øst 1 [%d]"      ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:06:C7" }
Rollershutter Vindue02 "Vindue spisestue øst 2 [%d]"     ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:30:0A:CD" }
Rollershutter Vindue03 "Vindue stue nord-øst 3 [%d]"     ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:12:03" }
Rollershutter Vindue04 "Vindue køkken syd-øst 4 [%d]"    ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:08:7B" }
Rollershutter Vindue05 "Vindue stue syd-vest 5 [%d]"     ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:14:5B" }
Rollershutter Vindue06 "Vindue spisestue vest 6 [%d]"    ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:30:0C:A1" }
Rollershutter Vindue07 "Vindue køkken nord-øst 7 [%d]"   ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:0D:0D" }
Rollershutter Vindue08 "Vindue stue nord-vest 8 [%d]"    ["Blinds"] { velux="thing=actuator;channel=serial#56:08:1D:26:06:29:14:5C" }

My garagedoor is a switch type. So if I understand you correctly - If I add the Blinds tag to this item, I can controle the garagedoor by saying either open or close?
(Its working with turn on/turn off atm).

I noticed the same. Voice commands work fine though. So things like open, close, stop and a percentage work fine. (Except for the inverted issue mentioned before)
I’d say this is fully related to how Google has implemented this though.

Humidity doesnt show, but should work.
However, I have not been able to get it to work for quite sometime now… I think it´s an Google issue… When I ask whats the humidity is in a specific room, Google tells me it´s unable to help. But it did worked some time ago.

I just tried voice command, asked Google to open one of the windows… It wasnt reversed, infact it send value 100 to the item.

From my point of view, it would also make more sense to send the commands UP and DOWN instead of 0 and 100 for the voice commands “Shutter up” and “Shutter down”, as is the case with the default buttons.