Time of last event(s)


#1

1) Give a description of the problem
Hi. I can use the age and agePrevious functions to determine how long since a door opened/closed.

i.e.
image

and

2) What is the expected behaviour?

This needs no trigger, I can call whenever,

I’m assuming this will screw up if the events roll-over midnight, so is there a better way of using this kind of expression, again, avoiding the need to say, store a variable at the point of the contact changing?

Also, is it possible to actually grab a timestamp of sorts for this? I’d like to be able to display info on when the door last opened/closed.

Hope that makes sense. Ta!

3) What is happening/not happening?
(PUT YOUR INFO HERE)

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

If I’m not mistaken your timestamp is $now-age([deviceName:attribute])

Also, I don’t think it would be affected by midnight rollover.


#3

easy when you know how. which I don’t. :smiley:

Thanks !