Charting a LastUpdate DateTime value

As of OH 3, Expire is not a binding. It’s a built in function.

And bindings are not ever assigned to Items. Items support metadata (the stuff between { }) in a .items file. That metadata can be used to link an Item to a Channel, or it can be used to configure the Item’s behavior (Autoupdate, Expire) or MainUI (State Description, Default X Widgets), 3rd party service integration (Google Assistant, Alexa integration), and you can put your own stuff into Item metadata.

As for Expire, it follows the same format for the Item metadata as was used in 2.5 to configure the binding. In OH 3 a number of new features were added:

  • change whether Expire updates or commands the Item
  • option to ignore state updates that do not result in a change
  • option to ignore commands

I don’t see it documented anywhere in the docs. It probably should be a section in Items. It’s not been a big deal until now I think because it’s self documenting in the UI.

One thing you can do to learn the text file syntax of a Thing or Item Metadata in a text file is to configure an example in the UI, click on the Code tab, and translate the YAML you find there to the custom XText syntax used in .items or .things files.

For example, for metadata, the overall syntax is (see Items | openHAB):

<namespace>="<value>"[<config1>="<value>", <config2>="<value>", ...]

So given:

the metadata would be

expire="1h2m3s,command=ON"[ignoreStateUpdates="true", ignoreCommands="true"]

The extent to which a Binding is assigned to an Item, it’s done through a Channel Link.

It’s hard to make something out-of-the-box because what constitutes “offline/not reporting” can vary widely from technology to technology and from device to device.

But there are two rule templates on the marketplace that handle these use cases.

There is no such thing as an Item being OFFLINE.

You can set the Item to some value that indicates it’s offline (not UNDEF or NULL as those don’t get saved, or use periodic persistence strategy to repeat the last state every minute in the database. That will make the chart look more like a stair step than saw toothed. Or you can use Grafana which has more features on how to handle this case built in.