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”
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
Install the REST API Docs from the Misc tab in PaperUI
Assuming your lock is represented as a Switch Item named “Lock”
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.
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.
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" ]