Item last update time (DateTime) for MQTT item don´t work

Platform information:
Hardware: RaspberryPi 3
OS: OpanHabian
openHAB version:2.5.7-1

I want to display when a sensor sends its last update and configured this item:

DateTime DeviceLastUpdate   "Last update [%1$tH:%1$tM %1$td/%1$tm/%1$ty]" <time> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity" [profile="timestamp-update"]}

But the value of “DeviceLastUpdate” ist alwasy NULL.

My item to get the humidity is:

Number Humidity_Temp_Schlafzimmer "Luftfeuchte [%d %%]"   <humidity> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity"}

So, where is my mistake?

At first glance it looks OK (though I can’t verify the date formatting you’re using at the moment). Have you waited long enough to get your first update since saving the Items file?

Do the logs show any complaints?

I wait since yesterday! :smiley:
I´ve forced the sensor to update a severall time.

There is no error or warning or somting like this in the log.

Hmmm, yes, looks like long enough!!

To rule out the date formatting: can you temporarily change the label to that from this tutorial?

You mean, that I have to change the format to [%1$tF %1$tR] ?
I did so but still negativ.

If I force the sensor to send data I can see the new vaules in the log but nothing about the DateTime-item.

Mysterious. The only thing I can suggest (until someone more knowledgeable turns up) is to restart openHAB.

Restart of openHaAB and reboot of the Server takes no effekt. :frowning:

It’s going to be something silly, like a typo.

Have you defined only one Item with that name? (including PaperUI created Items)

Is your xxx.items file fully loading? (see your openhab.log)

What does REST API say about your Items properties?

May we see your events.log showing “real” Item change?

What does REST API show about the links for your real and timestamp Items?

1 Like

Hi rossko57,
I´m an newbie in openHab so a silly mistake is possible :wink:

This item is unique and the hole .items file is working but ignors this item.

curl http://localhost:8080/rest/items/DeviceLastUpdate/state 
NULL[13:20:20]

My log after I change .items file and force the sensor to update:

    2020-09-08 13:22:37.322 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model `'aqara_tempsens.items'`
  `  ==> /var/log/openhab2/events.log <==`
        2020-09-08 13:23:27.505 [vent.ItemStateChangedEvent] - Temperature_Temp_Schlafzimmer changed from 21.19 to 25.06
        2020-09-08 13:23:27.531 [vent.ItemStateChangedEvent] - Humidity_Temp_Schlafzimmer changed from 61.99 to 95.01
        2020-09-08 13:23:37.798 [vent.ItemStateChangedEvent] - Temperature_Temp_Schlafzimmer changed from 25.06 to 24.35
        2020-09-08 13:23:37.828 [vent.ItemStateChangedEvent] - Humidity_Temp_Schlafzimmer changed from 95.01 to 95.21

How can I use REST API to show the link?

Install the the add-on option misleadingly named “REST docs”
It actually gives an interactive tool. You can inspect the Item properties the system thinks it has, in JSON form.
And find and inspect the links.

Could you show the full contents of aqara_tempsens.items ? I wonder if there’s something strange around where you have defined DeviceLastUpdate which prevents openHAB from loading it.

When you change and save aqara_tempsens.items, what do the logs (openhab and events) say?

Here is the aqara_tempsens.iems - File:

//Büro
Number Temperature_Temp_Office "Temperatur [%.1f °C]"  <temperature> (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:temperature"}
Number Humidity_Temp_Office "Luftfeuchte [%d %%]"   <humidity> (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:humidity"}
Number Battery_Temp_Office "Batteriezustand [%.1f %%]" <battery>  (Office,Temp) {channel="mqtt:topic:broker:TEMPOFFICE:battery"}
//Schlafzimmer
Number Temperature_Temp_Schlafzimmer "Temperatur [%.1f °C]"  <temperature> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:temperature"}
Number Humidity_Temp_Schlafzimmer "Luftfeuchte [%d %%]"   <humidity> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity"}
Number Battery_Temp_Schlafzimmer "Batteriezustand [%.1f %%]" <battery>  (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:battery"}
DateTime DeviceLastUpdate   "Last update [%1$tF %1$tR]" <time> (Schlafzimmer,Temp) {channel="mqtt:topic:broker:TEMPSLEEP:humidity" [profile="timestamp-update"]}
//Flur
Number Temperature_Temp_Flur "Temperatur [%.1f °C]"  <temperature> (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:temperature"}
Number Humidity_Temp_Flur "Luftfeuchte [%d %%]"   <humidity> (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:humidity"}
Number Battery_Temp_Flur "Batteriezustand [%.1f %%]" <battery>  (Flur,Temp) {channel="mqtt:topic:broker:TEMPFLUR:battery"}
//Bad
Number Temperature_Temp_Bad "Temperatur [%.1f °C]"  <temperature> (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:temperature"}
Number Humidity_Temp_Bad "Luftfeuchte [%d %%]"   <humidity> (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:humidity"}
Number Battery_Temp_Bad "Batteriezustand [%.1f %%]" <battery>  (Bad,Temp) {channel="mqtt:topic:broker:TEMPBAD:battery"}

After an update the logs just says:
020-09-08 14:43:07.159 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'aqara_tempsens.items'

Hi folks,
I´ve found the solution it was a mistake in my brain… :roll_eyes:
Simple and easy - I forgot to link the item in Paper UI.

After I do so, it work´s perfect.
Thanks to rossko57 because he gived me the hint with links.

But… but… the channel=“blah:bleh” you give in your Item definition creates the link. You should not need to do anything else in PaperUI.

I’m going to guess that the channel UIDs you gave in xxx.items file are rubbish, and you have now linked real UIDs in PaperUI. At the least you should clear those up, broken links can give you odd effects later.

Mh, that´s strange, because I had to linked every item to a thing, manualy.
Is this an option in the openHab-System?

No option. The {channel=“xx:yy:zz”} entry in your Items files creates a link. Either the file did not load or the channel ID was wrong. Look closely at the channels you did link n PaperUI and compare IDs.