How to Put Tags to things for use in Google home?

Tags: #<Tag:0x00007fc2017be858>

I’m running OpenHab 2.5.1 on an old W10 pc. Everything is running without any problems for a while now. I have added the OpenHAB Cloud connector.
The status on myopenhab.org is Online and I can use the myopenhab interface on my phone to control my house from anywhere.
No problem there. The problem I’m experiencing is when I try to link OpenHab to my Google Home.
I log in, authorise access, but OpenHAB is not being added as a service.

I build’ my whole setup simply using PaperUi and connected all modules using the VeldusBinding. Every module in the house is shown in my “Things”. I saw several video’s of people who succeeded in connecting to googlehome using "Tags"behind their “Items”, but i cannot find where i should do that? I didn’t use a texteditor for setup,just the paperUi.

Is there an other way to connect all my "things"to google Home so i can see them in my Google home app? Or a simple way to generate Items of my build so i can put “tags” behind them?

Update: I Got a tip to use “Rest documents” UI ,to alter taggs in things, but i do no see any thing Whatsoever in restdoc. I can not scan for all my used things and i cannot figure our how to show all my things in RestDoc??

NOTE: Everything is quite userfriendly and rather easy to setup a working installation, but why do this part has to be so complicated? In PaperUi You can go to your “things”…and click on the pencil to edit it. I allways wondered why it isn’t possible to simply make a function to put a tag behind an item in that field.? instead of making alterations in the code…maybe something for a future update?

1 Like

In PaperUI things, you can copy the channel info and use it in your items file.

Item file example with tagging:

Switch CouchLight "Couch Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff2:power" }

First of all, thanks for the reply but that’s exactly what i mean,

I never made any Item or Sitemapfile etc…
I never used a texteditor for creating my setup. I only used the paperUI, made the neccesary bindings to find all my Things,and made a simple to use controlpanel with HabPanel. Works perfect for me, i can do anything in my house by phone,browser or IPad. Now i want to connect googlehome but that seems to be rather difficult and only to achieve by writing some code,like you did in your answer.
My problem is, i’m a nobe concerning programmingstuff like that and i’m looking to the easiest way to make things work.

Items file? in never used things like that, where do i find them and how can i alter them? Or can i somehow generate itemfiles of my existing setup? so i can "tag"them afterwards.

Thanks for helping me out.

If you want to use the REST API, here’s some info that might help, from a current discussion about the new Google Assistant 2.0 integration. Personally, I don’t recommend going down this path.

Note that the integration is moving away from tags and toward using metadata (but tags will still work for the foreseeable future). You can see the metadata definitions that Google will recognize in the documentation, but it’s all shown relative to item files, since that’s what the majority of people use.

My advice would be to take a step back from Google Assistant and first get comfortable with .items files. That’s partly for your own education in OH, and partly because it’s much easier for the community to provide assistance if you’re going down the same path that most of us are. Once you’ve got your devices defined in .items files, adding the Google Assistant metadata is a very simple task.

PaperUI is not in active development; it’s used mostly to configure the base system, add bindings, and discover devices. There’s work being done on a replacement, but that’s in the distant future.

It sounds like you’ve used PaperUI very effectively to get to this point, and you’re ready to take the next step. That might sound daunting, but with .items files there’s no significant coding involved: each device you want to control will be one line of text in a file. I would suggest that some of the things you’ve already learned are just as challenging, so I’m pretty confident that you can handle it.

When I get stumped, I start by searching the documentation and community, because someone else has probably had the exact same issue. If you can’t find what you’re looking for, feel free to ask! No one here minds helping out so long as we see that an effort has been made. :wink:

1 Like

That makes it sound like “someday”. OH 3 is slated for release in a year and the PaperUI replacement should be in a usable state prior to that. So it’s not really so distant, all things considered. Yannick already had a great start on it.

2 Likes

Yeah, “distant” is subjective. I just wanted to communicate that he shouldn’t wait for it.

Cool things are changing however for today you can put tags in the rest api using your web browser

http://openhabianpi:8080/rest/items/itemname/tags/tagyouwant

http://openhabianpi:8080/rest/items/LoungeLamp/tags/lighting
1 Like

Hello Koert

Thanks for bringing this over to the openHAB2 community forum. :smile:

Just a quick question (speaking as someone who most definitely prefers to configure everything in PaperUi, as opposed to text files)

As you’ve got HabPanel up and running, you most certainly do have Items configured somewhere.

The questions is… How were they created?

By any chance… Do you have ‘Simple Linking’ On ? (In PaperUi / Configuration / settings )

Importantly, can you see an option for

PaperUI / configuration / Items

(Which should be just under Things)

Something like this

Hi Stuart,
Finally we meet @the OpenHabCommunity :smiley:
I’m not quite sure what you mean so let me explain what i did;
I Installed everything on a unused W10 workstation physically connected to a Velbus usb/serial device which is connected to Velbus installation.
I installed the Velbus,Bose Soundtouch(my speakers) and Icloud Binding and let OH search for all my things.It found
Then i linked the things to different items i use.
With all those items i created a working setup in Habpanel which i also can use on my IPhone and IPad.Besides that i can also see and use all my things in de OH app,from evrywhere so Icloud is working too. Thats it! Worked perfectly but i never wrote one line of text in the config files,never made a sitemap or itemfile…Since i want to connect all my things to GoogleHome I hoped that i could easily make some Tags in the Item by using PaperUi but that seemed impossible. I got a tip that i can use RestDoc but since i never created any written textfile myself nothing showed up there, or i didn’t understood how it worked :wink:

Note: Yesterdaynight after reading a lot of helpfull tips and documents i finally succeeded in making my first sitemap with two items ánd got googlehome working to operate the things!!!...Yeahh :smiley: I was so ecited that i almost didn’t sleep ha ha…
So…I finally got it to work but i must say that it’s not as easy as i hoped using PaperUi firstly.
I never worked with a texteditor to alter codelines and stuff so i used notepad.
I can imagine that this is not the most neat way, especially when the config becomes more expanded.
If there is an other easier way i’d prefer that…

1 Like

Indeed :slight_smile:
I’m certain you are very welcome to the party :smile:

This this is the step I’d like to focus on.

How did you link the items?

(I too didn’t touch a text file, until I started to look at DSL rules and complex DMX setups)

To this day, I still don’t use sitemaps, instead I do everything in HabPanel, but that doesn’t help you with getting the tags onto your items so that Google Assistant can start working.

Simply by clicking on one of the items and selecting one of the available (blue) buttons, then selecting the appropriate channel in the dropdown menu in the popup.

sorry i mean,one of the Things…

But maybe you mean how i linked them finally to google home?

No, that’s okay.

I understand.

The important this is that you ‘decided’ rather than used “simple linking”.

So…

Have you got an Items menu as in the picture above?

Congrats on getting it worked out! For writing/editing code, many of us use Visual Studio Code with the openHAB extension. It colour-codes your text and can help you debug your code.

1 Like

If you can see the Items menu, you should only have to follow these three steps, for every item you want to add a Tag too.

(That big Google assistant thread has a list of the appropriate tags)

  1. Find the Item you want, then click on the double boxes to copy to your clipboard

  1. Go to the Rest Docs API and find the Items section, then look for Put Tag

  1. Now paste in the Item unique name, add the Tag.
    This is a dimmer item, so the tag is “Lighting”.
    Watch out for a capital for the first letter.

Then click on Try It :smile:

You’ll need to update Google Assistant… Which may take some time

Thanks, ok i’ll try that .where do i get the extension? available in VSC? or somewhere in the OH site?

I was going to say that the link to the VSCode extension is in the documentation, but the URL I sent you doesn’t seem to work now. Let’s try that again.

Extension is available at VSC Markerplace, just search for openHAB.

That doesn’t look so difficult :grinning: I will try that too
So the tag will be written in the registry? or does it also create a .item file?
With the tag connected i can use it in google but not in the OH app or basicUi i Gues? since there is no sitemap made and no icon attached?

As you created your Items in PaperUi, they are all in the openHAB2 JSON database, which is where all text files get loaded too.

(I tried directly editing that and while it worked, I ended up in a right mess.)

So the best way to add a tag to the JSON dB is using the Rest APi.

Unless…

You manually (re)create all your items in a text file