Displaying Items' lastupdate in sitemap?


I’m using OpenHAB and everything is working very well. Now I would like to display the lastupdate property for my items in my sitemap, but I can’t seem to find any information about how to do it without creating a new DateTime Item and updating it’s value with a rule based on changes to the original Item.

However, if I look at the Items tab on my.openhab.org/items, each item already has the last update timestamp. I would like to be able to display this on my sitemap and especially for groups.

As an example, I have a hue light:

Dimmer hueFrontPorch "Front Porch [%d %%]" (gAllLights,gDusk) {hue="4;brightness"}

and a corresponding group:

Group:Switch:AND(OFF,ON) gDusk "Dusk"

In my.openhab.org/items page, it says:

gDusk 		OFF	Today at 7:14 AM
hueFrontPorch	0	Today at 7:14 AM

I’d like to put that timestamp in my sitemap as an easy way to make sure the lights are going on and off when I expect.

So, do I need to create a rule and track these separately even though OpenHAB clearly already has them somewhere since it’s displaying them on the my.openhab?

Thanks for any pointers

Yes, you will need a rule to update a time. Something like this:

rule “Motion alarm Garage”

when Item Arduino_Motion01 received update

if (Arduino_Motion01.state == ON && Home_Alarm.state == ON) {
     	pushover("Motion in garage detected", 1)
     	postUpdate(Arduino_Motion01_Time, new DateTimeType())  }



DateTime	Arduino_Motion01_Time	"Last Motion [%1$td %1$tb at %1$tR]"```

Yup, a rule and separate item is the only way I have seen how to do it…

That’s actually kind of surprising. you can’t pull from the persist db for the last change?

That is correct. The sitemap only can see Items and their current states.

That’s interesting. Does someone have an example for how this is being done? Thank you in advance!


Just checking if this is a feature on a todo list for future ?
ie extracting last changed date of item and make it available to sitemap

I don’t think it’s on anyone’s list. If it is it is a really low priority. As shown above, there is a very simple work around using Rules to make this possible.