alexarch21 / history-explorer-card

A card for Home Assistant Lovelace for exploring the history of your entities interactively and in real time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timeline chart: tooltip only shows visible times (not real times)

kusmi opened this issue · comments

When zooming into a timeline, the tooltip only displays the currently visible times and durations - instead of the real ones. See attached screenshots

Screenshot 1: When zooming out you see "rural amenities detection" took 6h36m11s:

Screenshot 2023-09-15 at 09 53 24

Screenshot 2: When zooming in, the tooltip now just displays 2h:

Screenshot 2023-09-15 at 09 53 48

That's a limitation of the HA recorder API, which will generate 'fake' state times on partial database requests. There is nothing I can do about this, I'm afraid.

The only workaround is to load a longer timeframe when the card opens, using defaultTimeRange. The durations will then be correctly reported within that time range.

ok I see, so this looks like more of a bug/feature report for the HA recorder team :-)

Well, yes and no. It's complicated 🙂

This is definitely not a bug in the recorder. This was a conscious design decision on their side. I'm not exactly sure about the why, but they probably had good reasons to go that way. Changing this behavior now is going to break lots of things.

Now, the history explorer could handle this situation / limitation a bit better. These virtual states are DB artifacts and could be filtered out. But this is very finicky abd will not have 100% success rate, as it is not always possible to distinguish between virtual states and an actual real state that just happens to be in the wrong spot.

So I took the easy way out and just clamp the state duration to the visible cache boundaries and just do some simple (but safe) double state filtering within the visible area.

In conclusion, this is a known limitation at this time. If you need 100% correct time stamps and durations, the best way is to export as csv.