How to get "last known value" while sensor is in deep sleep

I came across this as the solution for my own ESPHome sensor that goes into deep sleep. This seems to work well for me.

Now, what I want is for the sensor to become “unavailable” if it does not phone home in the requested time interval. Let’s say it’s supposed to report a value every hour, then go back to sleep. How can I set up the sensor so that it will show as unavailable if a value has not been reported in the last hour? Would this have to be done via a template sensor that checks when the last reported value was?