Timestamp, last movement/ occupancy

Hi there,
i am trying to get the timestamp from the last time my motionsensors (Hue, Aqara FP2 or Reolink cameras) detected motion.

In order to avoid “false” alarms i suppose that it must be when the state goes from occupied to not occupied.

Otherwise i suppose that the time stamp would get updated also in case of power cuts or if the sensor goes unavailable etc…

Or does anyone have any better ideas?

Primarily I simply want to display this timestamp on card on the frontend.
Alternatively save the timestamp as an additional sensor and use the value for other purposes

I am not a coder, sorry. So i need exact and specfic help :slight_smile:

Thank you in advance
/Bo