openHAB Google Assistant Integration v2.0

For sure. I think it’s great going forward, and when I do get to it I’ll likely do everything at once for the sake of consistency. I’m particularly curious if it can improve GA’s interaction with my rule-based thermostat (combining a Z-Wave sensor, gas fireplace, and plug-in air conditioner).

I wanted to deploy it last week and was lost in other work. I will take time to deploy latest version at latest tomorrow night as there were no issues at the test instances of others.

4 Likes

Also didnt had time to lookup here, so I just saw it now. Maybe I shall activate notifications again…

2 Likes

@All,

latest version of openHAB GA Integration with MetaData support is deployed. Please let us know if everything still fine.
CC @michikrug

5 Likes

Great Job, Marzima.
I havn´t tried the new MetaData yet though. And before I do, I would really like some explaination about a few of the options from the Doc:

Switch { ga="Lock" [ tfaAck=true ] }
Switch { ga="SecuritySystem" [ tfaPin="1234" ] }
Dimmer { ga="Speaker" }
Switch / Dimmer { ga="Fan" [ speeds="0=away:zero,50=default:standard:one,100=high:two", lang="en", ordered=true ] } (for Dimmer the options have to be set)

ga=“Lock” - What does tfaAck=true mean?
ga=“SecuritySystem” - What does tfaPin=“1234” mean?
ga=“Speaker” - Is this a volume control (I think it may be, since its a Dimmer. But I just had to make sure).
ga=“Fan” - This one is very confusing… What does all the metadata means? I assume it depends on using either Dimmer or Switch. But thats just a thinking?

I miss a door contact or something simular. There is a ga=“Door” and a ga=“Garage”, but they´re Rollershutter types… Isn´t there something for a simple door/window contact type? Switch wont work when it´s a contact as it should value OPEN/CLOSED.

Great work! I look forward to trying this out. Looking at the docs a little more closely I see

NOTA : metadata is not (yet?) available via paperUI. Either you create your items via “.items” files, or you can:

Besides the misspelling of “NOTE” (“Hey pot, you’re black”), I think I can answer this. Metadata is definitely not available in PaperUI and will not be available in PaperUI. It should be available in the replacement to PaperUI. There are a couple of REST API end points available to add/remove metadata on Items so it is possible to add the info just like we used to using the REST API Docs to add tags too. Just use PUT /items/{itemname}/metadata/{namespace} instead of PUT /items/{itemname}/tags/{tag}.

Unfortunately there isn’t really a REST API endpoint to easily get all the metadata settings on a given Item, but you can use the GET /items to only get those Items with a specific metadata setting.

Metadata is available in Scripted Automation so you can get and set them from Python/JavaScript/Groovy Rules if you have a reason to, so you could set these through Rules as well if that is easier for you. It is not available from Rules DSL though. See Design Pattern: Using Item Metadata as an Alternative to Several DPs for examples of that.

TFA stands for Two-Factor-Authentication
https://developers.google.com/assistant/smarthome/develop/two-factor-authentication

Thus, with tfaAck=true you can require explicit acknowledgement (yes or no).
With tfaPin=“some-pin-of-your-choice” you will be able to require a personal identification number (PIN) to be said before the action is executed.

Speaker supports the volume trait. You are able to set absolute values as well as relative volume changes.

Fan supports OnOff as well as the FanSpeed trait (https://developers.google.com/assistant/smarthome/traits/fanspeed).
This requires a bit more complex configuration, since we need a mapping from modes to numbers.
With the speeds config you set your desired speed values that are mapped to spoken modes.
E.g. “Set fan speed to high” would execute setting the Dimmer value to 100.
The value before the “=” is the value to set, after the “=” the mode name(s) are stated, there can be multiple ones divided by “:”. You can set a language and if the values are ordered. If they are ordered you can also say relative changes, like faster or slower.

There are no sensors or contact devices in the current Google Home world. Thus, there is no support for that.

More or less this is correct.
I will also not implement any new functionality based on tags.
So, everything that now works with tags will keep working, but no new devices or traits will be added.
Also all the new configuration options will not work with the tagging option.

This is damn great! Best part is, it works on all devices according to the link.
Now I can arm/disarm our security alarm system (switch on/off) with acknowlegdement of a PIN code. Well, arm the alarm doesnt need ack… But disarm does indeed.

I sure has to play with this…

Hmm… okay…

Hello, @michikrug , there is roomHint option ? because I see in the pull request on github ?

Hi

Switch { ga="Scene" }
doesn’t work for me (not recognized by GA), while
Switch { ga="Light" }
for example works.

Is this a known bug?

This is a bit strange - and I suspect a bug on Google’s side here.
The sync will add the device and you can control it, but somehow it will not be listed as an entry (icon) in the Google Home app.

Yes the support is there, just add [ roomHint="yourRoom" ] as metadata config to your items.

1 Like

What is roomHint for? Just naming the room?

“If the third-party partner’s cloud configuration includes placing devices in rooms, the name of the room can be provided here.”

So I assume it helps already suggesting a room when synching devices.

Google supports a queryOnlyTemperatureSetting for the TemperatureSetting trait. Could this be used to expose simple tempsensors so you can get just a temperaturereading without creating a Thermostat group for each sensor?

All my tempsensors (except for one defined properly as a thermostat group) disappeared when updating to use metadata. Perhaps this happened with the v2 update, I haven’t synced my items to GA since then I believe.

There is proper temperature sensor support implemented.
This also requires a Thermostat group with having only this one number item as a group member with the proper tag CurrentTemperature or ga metadata value thermostatTemperatureAmbient.

Creating a Thermostat device with only a temperature item is not supported anymore.

2 Likes

Hey my Thermostats worked for a long time.
Now i switched to the metdata item definition and noticed that i can not set a temperature anymore (also not with the tag item definition). I just get the answer “Sorry this mode is not available on this device”.
Any ideas?

Could you have a look what values your openHAB items are receiving from the action?
The “not supported mode” answer should happen, when openHAB itself responds with a 400 (bad request) -> bad values were sent to the items.

I think Kim’s questions and your answers point to a deficiency in the docs. As a user who doesn’t know anything about GA beyond asking it to do things, how am I to know what configuration options are available on each of the ga device types and how am I supposed to know what it means? For example, the only place I can find anything about [ useFahrenheit=true ] on the current documentation page and any of the pages that page links to is the fact that it is used in a couple of the examples. Is there a useCelcius or useKelvin? Can I use tfaAck on any device type or only the Lock and Alarm type?

I notice at https://developers.google.com/assistant/smarthome/traits/temperaturecontrol that there is a temperatureStepCelsius attribute. Does that mean I can set that using [ temperatureStepCelsius=.5 ]?

If this information is contained in the Google API docs our docs should link to them at least. If not, we need to provide at least a hint on how to discover and understand what attributes are availalble and what they need. Otherwise this thread and dozens more will be created asking for the same information over and over again.

I’ll even volunteer to write it if it helps, but right now I’ve no idea how to figure out what is available and what it means on each device type.

1 Like