I have a Lovelace dashboard and it shows the current state of both my garage doors, as well as the time that state last changed. The problem is that the garage doors occasionally go offline for a few seconds, so the dashboard shows when the garage door came back online as the last changed date.
I guess I could make a custom sensor for each garage door that would capture the date every state change, ignoring the unavailable state, and then use that in my dashboard, but was wondering if there is a better way to do this?
Do not see a better way.
Frontend may only show data for a states object (as is or processed); then you need to keep somewhere a time of the last “correct” change. The only way I see is a template sensor.
But - anyway it will show a wrong time after HA restart.
Surely you may run an automation monitoring “correct” changes, setting values for “input_datetime” helpers, and then show these “input_datetime” values in Frontend (by template-entity-row, for instance) (but still many places in UI like more-info will show a “last-changed / last-updated” value which may be incorrect)