How to alert if a Smoke / Water Leakage sensor hasn't updated its state for a long time?

I have an Aqara water leakage sensor that (thank god :grinning:) almost never sends status changes.

I’d like to know if this sensor stopped working and has not connected the Zigbee coordinator for a long time.

In the UI I can see a field named “Last Seen:” that contains the value I am interested in:

But there seems to be no way to access this value from with the code.

I managed to use templating to access some values, like for example this one here:

{{ states.binary_sensor.lumi_lumi_sensor_wleak_aq1_0ac73206_ias_zone.last_updated }}

The problem is: water leakage sensors, or smoke detection sensors, change their state only very rarely - hence the “last_updated” (or “last_changed”) values are not useful for my purpose.

My question: Where does the UI get the value of “Last seen” from? Can I access this value in the templating?

Did you ever figure this one out? I am in the same boat.