Help with Google Assistant/Home

Hi. I am new to openhab and I have it all setup and running well in a docker on linux. I have all my devices setup including zwave locks and myopenhab.

I am now trying to get my locks into Google Assistant. From what I have read, you need .item files but since I have only ever used paperui, I dont seem to have these. For right now i just want to add the two zwave locks. What is the best way to go about this? Currently when linking openhab to Google Assistant I am seeing just some of my items but they are all named “Brightness” or “Color”

Any guidance would be appreciated.


Hi Bill, and welcome!

If you haven’t yet gotten into using .items files, then I think you’re probably getting a bit ahead of yourself. It’s time well spent learning about them, as they offer a lot more flexibility than PaperUI.

You can add items to Google Assistant via REST, but I don’t personally know how to do that.

Have you gone through the new user tutorial that takes you through items, basic rules, and sitemaps? If not, that’s where I recommend starting. It doesn’t take long, and will enable you to better understand what you’re reading when you search for examples in the community.

Once you understand .items files, it’ll be really easy to see how to tell openHAB to expose your items to Google Assistant.

There are two ways to do this now that the Google Assistant integration is based on Item metadata, a hard way and an easy way. As Russ indicates, the hard way is the REST API. The easy way is .items files.

Harder Way: REST API

  1. Install the REST API Docs from the Misc tab in PaperUI
  2. Assuming your lock is represented as a Switch Item named “Lock”

NOTE: I’m kind of guessing how this works here. I might not have the curly brackets right and there might need to be some square brackets:

{ "value": "Lock", "config": { ["tfaAck": true] } }

In short, I’ve not tested this way. Notice that there isn’t a way to get the metadata set on an Item. Instead, you have to go to the REST call that returns all Items and supply a metadata filter. That’s one reason this approach is a little hard.

Easier Way

Define the Item in .items file and just add the metadata to the Item inline with the Item definition.

Switch Lock ... { channel="zwave:device:blah:blah:blah", ga="Lock" [ tfaAck=true ] }

If you have Simple Mode turned on, turn it off now and delete all the Items it automatically created. You will want to manually define Items anyway and you’ll have to do this at some point anyway, may as start now.

1 Like

Thanks so much Rich! This totally helps. I was able to get it to work with some googling before i saw your reply with this:

Switch FRONT_DOOR “Front Door” [ “Lock” ] {channel=“zwave:device:9f8222b2:node2:lock_door” }

Added the [ “Lock” ] and it shows up in Google as “Front Door”

Is there any benefit to doing it the other way by adding the ga=“Lock” after the channel def?

The method Rich showed is the “new” way to connect devices to Google Assistant using metadata instead of tags (which is what you’ve done). The tags still work, but there’s no further development on them.

The [ tfaAck=true ] part enables you to require a confirmation when unlocking via GA. Alternatively, you can set a PIN code with [ tfaPin="1234" ]

You can see all of the available item types here.

Glad you got it working!