Template to return state of entity X minutes ago

Is there a way to find the state of an entity X minutes ago?

Not with a template. To access past values you need to use a SQL sensor.

1 Like

Thank you for your reply! My use-case is an automation with a condition that verifies the state of an entity 15m prior. It seems very “heavy” to create a sensor that will constantly update rather than just when the automation is fired.

I will see what I can construct. Hopefully this ability will be added to HA templating in the future, especially with the new recorder functionality in 2023.12.