My understanding was that last-changed would tell me when the state of the entity would change, which seemed nice because it would let me, at a glance, see when the door reached its current state (closed, open, etc).
When home assistant starts (e.g. after a short restart or being off for a long time) all entity state values and attribute values are set to unknown. As home assistant has no idea what happened to the entities while it was off. The entities are then either updated or restored. In either case this causes the last updated and last changed properties to be changed. This is not going to ever be “fixed”. It is how home assistant works.
This makes a lot of people very mad.
There is a popular feature request (or maybe WTH topic) asking for an additional property that does not reset when home assistant starts and is only updated when the integration changes the entity value. This may eventually be implemented.
Until then you may have to implement your own template sensor that records the time and date whenever the cover changes to open or closed.
Hmmmmm. Thank you. I did do an update this morning, so I think that is what happened here. But I feel like prior to the update it was saying like 5-6 hours, implying the door opened in the middle of the night.
Thanks for explaining that, I will take a closer look and see if it aligns with that.
Unknown would actually be a lot better for me, but if last_changed and last_updated are apparently getting updated with time of boot… Well… Yeah. Guess I’ll have to go the sensor route.
(Or maybe I could do something like compare the boot time to the last_changed time and if they match – or something like that – display Unknown.)
What I’m trying to prevent here is other family members from seeing this and wondering why our garage door, or other things, got opened while they were sleeping. So, if the other things don’t work… I’ll just not display the info.
Just as a disclaimer, I work in a similar systems background, so I see it as:
When did the counter last get updated by the OS? When it last changed, or at boot, and that’s what HA shows for last_changed. Which is rational.
vs.
When did the device last actually make a change. Which would require some persistence (which HA doesn’t do). Which would also be rational. But it’s not what HA does so… constraint of the system.