JavaScript - lastStateChangeTimestamp and lastStateChangeInstant both return null

I’ve got an item dbe_thuis_owntracks, which has had state changes and updates:


&

According to the documentation (Item - openHAB JS & JavaScript Scripting - Automation | openHAB), the following should work:

var dbethuisinstant = items["dbe_thuis_owntracks"].lastStateChangeInstant;
var dbethuistimestamp = items["dbe_thuis_owntracks"].lastStateChangeTimestamp;
console.log("dbethuisinstant = "+dbethuisinstant);
console.log("dbethuistimestamp = "+dbethuistimestamp);

The output, however, is null:

17:31:57.794 [INFO ] [enhab.automation.script.ui.scratchpad] - dbethuisinstant = null
17:31:57.795 [INFO ] [enhab.automation.script.ui.scratchpad] - dbethuistimestamp = null

What am I doing wrong?

Mmm, the code does work with an item that’s been changed recently. OpenHAB has restarted since the last state change of dbe_thuis_owntracks, so I assume that’s the reason.

Can someone confirm?

Yes, but if you have restoreOnStartup for these items, that should restore these timestamps as well if possible.

Apparently, that check box is not checked! I wonder why. Is there any reason I might have unchecked it? Is there a drawback to checking it?