Convertion of .items files to OH 3 UI metadata

I’ve started again with a fresh install of openHABien 3 with the main aim of getting my old HEOS MK1 speakers to work with Google assistant.

Taking the UI route, I’ve got the speakers configured as far as items, but I am a little stuck on working out how to put the information shown in the .item file into the metadata code window in the UI.

The document says:

Assumptions for UI: The examples below assume that the user is using a text editor to create a .items file. While the way of defining an Item using the graphical, interactive UI is different, the elements and the nature of an Item definition are identical using either method.

Source: Items | openHAB

However, what I see in the UI is considerably different and I cannot find any examples of what it should look like. To start with, I am trying to set up just the mute item:


Using the UI, under:
Items > Mute > Add Metadata > Google Assistant
I have set:

  • Google Assistant Class = Speaker
  • Name = Mute
  • Room Hint = Living Room

Switching to the code view I see:

value: Speaker
  name: Mute
  roomHint: Living room

Although I can see there are similarities to .items, I don’t know what the keys and values should be in the new UI view.

OpenHAB is listed in my Google account, and although I have linked it in Google Home app, OpenHAB does not show under the list of linked services (under “Works with Google”). I assume this is because my item metadata is missing vital information.

One would like to think that setting the Google Assistant class to Speaker would result in the UI showing the attribute fields for that class:

Is this the case, or does one have to add extra information under the code tab?

I’m sure there could be a million things wrong, but I feel I am missing metadata, so if anyone can provide any examples of item metadata or tell me how the attributes map between the items file and UI metadata code, I’d be most grateful. If I can get it working, I will gladly raise a PR to update the documentation for OH 3.


1 Like

There is definitely some confusion here and it’s not clear where exactly the confusion is.

If you are creating an Item in a .items File you would add Item metadata to your Item. Item metadata goes between the { }. Looking at the docs for Google Assistant a Speaker GA metadata is only valid for Dimmer Items, not Switch Items. So that could be one problem. This Mute Item probably needs to be configured as a ga="Switch" instead.

Looking at an example in the GA docs, the following ga metadata

ga="Speaker"[name="Mute", roomHint="Living room"]

would be shown to you as

value: Speaker
  name: Mute
  roomHint: Living room

in the UI.

You don’t really need to know this. All you need to do is fill in the form. All of the valid keys and values are provided to you in that form. Filling in the form fills in the metadata.

It is. According to the docs, Speaker doesn’t have any attributes that are unique to it. And all the common attributes (name, 2FA, Room Hint, etc) are shown. If you chose “Fan” or one of the other attribute classes that have more attributes, those would be shown to you in that form so you can set them.

I think the root of the problem is you have to use the right Item type for the corresponding GA class. The GA classes are not really all that robust. The Speaker class, for example pretty much only controls the volume level. It doesn’t support a separate mute switch, it doesn’t let you choose what to stream to it, or anything else you might expect a speaker to do.

In all likelihood, if this is the only Item you’ve configure for GA integration, it’s generating an error and Google doesn’t see any devices and therefore the sync to openHAB fails.

Hello all, I’m beginner and I love much textual configuration in OH for me is much easy,
have a problem with “Group:Switch” google metadata,
for an real item(physically switch):

Switch    ESP_power_1     "Esp 1"     <light>     (All_light_FristFlor)                           [ "Lighting", "Switchable" ]    {ga="Light", channel="mqtt:topic:esp:switch_1"}

work perfectly,
but, I want to add to google home a Group:Switch (to switch all my christmas light at once)

Group:Switch:AND(ON, OFF)    Christmas_Master         "Christmas Master Switch"    <switch>            (LivingRoom)                 ["WallSwitch", "Switchable"]

when I add

  { ga="Switch" }   or   { ga="Switch" [ inverted=false ] }  or  ga="Switch"[ inverted=false, roomHint="Living room" ]
Group:Switch:AND(ON, OFF)    Christmas_Master         "Christmas Master Switch"  { ga="Switch" }  <switch>            (LivingRoom)                 ["WallSwitch", "Switchable"]

all my items and things, model scheme disappear, I think is a syntax error I made,
but when I config it in UI Group Switch google metadata it’s works perfect.
I did not find a full example with a group switch metadata in the items files.

Could you try moving your metadata declaration to the end of your line?


Group:Switch:AND(ON, OFF) Christmas_Master "Christmas Master Switch" <switch> (LivingRoom) ["WallSwitch", "Switchable"] { ga="Switch" }

The documentation states that the order must be kept.


Hello, thank you much,
it works perfectly, for Group:Switch metadata needs to be on the end of the group line.
thank again.