Metadata documentation

Is there documentation about the different kinds of metadata? I don’t know much (if not practically nothing) about it, but can’t seem to find any documentation around it.

I e.g. just learned there’s a feature to have a delayed command/update when a switch is switched (Expiration Timer). I’m eager to find out other gems like this. :slight_smile:

There is no central documentation for what I’ll call “well known” metadata. The concept of metadata is covered in the Concepts page for Items: Items | openHAB.

Not all of the well known metadata is relevant all the time for all users. For example, the Google Assistant metadata is irrelevant for those not using Google Assistant. But that metadata is in fact documented in the Google Assistant docs, same for Alexa.

In MainUI you can find all the well known metadata options by navigating to Settings → Items → Any Item from the list. Click on “Add Metadata” and you’ll see them all in a list. Selecting one will give you a form explaining and letting you set any of the options for that metadata.

Clicking on “Exiration Timer” gives you

Clicking on the code tab shows the settings as YAML.

value: 0h5m0s,command=OFF
config:
  ignoreStateUpdates: "true"

That can be translated to .items files as follows:

<namespace>="<value>"[<config1>=<value1>,<config2>=<value2>]

The values is required but if there is no value use an empty string "". If there are no configs leave out the [ ].

The above would translate to:

expire="0h5m0s,command=OFF"["ignoreStateUpdates"="true"]

Metadata Purpose
Unit if the Item is a Number:<type>, sets the unit the Item’s state will be converted to prior to updating the Item
State Description a collection of properties to control how the Item is displayed on the UIs
Command Options Mapping between commands sent to an Item and commands that get sent to the Channel.
Synonyms Used by HABot, alternative names for the Item
Default X Widget Used to control how MainUI displays the Item by default
Autoupdate When false the Item will not be updated in response to a command, default is true
Expiration Timer how long after an Item changes from a given state that it is commanded or updated back to that state
Voice System Settings for the Item used by the voice subsystem
Amazon Alexa, Apple Homekit, Google Assistant Controls what Items are exposed to these third party services and how they are exposed
Android App Device Controls Android App | openHAB

You can also enter your own Item metadata and access it through certain MainUI Widgets and rules.

What does this mean exactly? I’ve seen that term ‘mapping’ around, but I can’t figure out what it means…

Is it possible to use this metadata to give another item a command?

No. You can change the commands to an Item using a profile but not Item metadata.

Let’s say you have an Item that represents a remote control. The device expects commands that are a number: e.g. 1, 2, 3, etc. But you want to use something more meaningful in OH so you can map 1 to "Play" through the Command Options. So in OH you use "Play" everywhere but when you command the Item with "Play" it gets mapped to 1 before it goes to the device.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.