How can I display the time of a sensor in the frontend, when it last had the status "On"?

Hello,

I would like to see when a sensor in the frontend had the status “On” for the last time.

image

states.binary_sensor.XXX.last_updated

Basic idea:

  1. Add a Date/Time component:
  1. Create an automation that uses the state change of your sensor to ‘on’ as the trigger and that then sets the Date/Time value in the component you created in 1 based on now().

This should also keep the value after a re-start.

1 Like