A usable logbook

I made a custom component that will keep recent logbook entries pre-loaded in memory. This makes them immediately available when the Logbook panel is opened, decreasing loading time to a couple of seconds.

It is available in HACS as “Logbook Cache”.

More information in the GitHub repositioty: https://github.com/amelchio/logbook_cache

Update: now deprecated.

9 Likes

Thanks for thinking about us, mere users :wink:
I have been trying to convince the HA devs to slightly change the way the logbook works, namely: when one opens it, nothing happens until an DISPLAY button pressed. That will let user to select how many days they want to look back, what entity to display (if any) etc. I think it makes sense, especially with such a slow thing as a native logbook. Unfortunately, we are still where we are.

Any chance of having something similar in your component?

2 Likes

With my component, I think opening the logbook is fast enough that such a change is not needed.

1 Like

Thanks for the answer.

Hi, thanks for sharing. Great work, I haven’t tested it yet but I’ll do soon. It’s really sad the main components like logbook/history or recorder don’t get any attention in the main development.

What do you think about a second inmemory recorder to store entities which don’t need to be persistent at disk but would be needed to for the frontend. For example showing a graph current network traffic or helper input_boolean. I haven’t found a solution for a hybrid (inmemory and persistent) database

I think it is better to fix the primary storage rather than adding workarounds (which is why I am not pitching my workaround for default inclusion).

Developers are aware of the performance issue but the path forward is still undecided.

1 Like

I’m with you here.

Very informative discussion at the link you provided, but the topic doesn’t seem to have enough attention so the future is in clouds. :\

1 Like

You are right, the logbook is currently not much of a priority.

A long-term goal of the recorder is to support automating the home (for example with future machine learning components). The logbook and history views are more like auxiliary features, not the very purpose of the recorder.

So the quandary happens when proposed optimizations to the logbook/history can jeopardize the long-term goals of the recorder.

Also, it is working just well enough that so far nobody has been bothered enough to rewrite it completely.

If you have the resources I definitely recommend users install this. I don’t believe its taking that much memory up for me. I believe this will make me much more likely to make use of the logbook for troubleshooting! Thank you.

This would be a nice optionally enabled feature built into the logbook. But I understand it gets complicated.

1 Like

As generic_thermostat is?
I’m not complaining/flaming/trolling, but that’s a fairly stretched statement. I know it’s all about people making their PRs and unfortunately cannot do this particular bit myself so just keep doing what I do and waiting for better future. Just wanted to state that nobody has been bothered enough to rewrite it completely doesn’t mean it is working just well enough. We have no choice if we stay with HA.

If anyone is using this, I would like feedback on how it performs with your setup?

For me, logbook loading time has decreased from about 15 seconds to 1 second. Memory usage increases by about 10 MiB (I cache 8 days) and I do not notice any slowdown when the cache fills during restarts.

Hi! I’ve installed this plugin and had it running for about 30 minutes now. I’ve a few metering plugs in my setup and I can say that the loading time of their lovelace cards is significantly faster! Thanks for your work!

Well that sounds good but I am actually surprised if the component helps Lovelace cards since it only improves the logbook, not history.

hmm, sorry, maybe I’m mistaken :wink: they really seem to load faster

Well, history and logbook do use the same database so maybe there is some positive interaction after all. As long as it doesn’t get worse :smiley:

I have tried installing twice and both times nothing shows when I try to view my logs after the install.

Its working great @amelchio! Thank you. Very fast and memory difference is very minimal. I think it is at most 100mb of memory. But, I’m a stay-at-home dad and I treat Home Assistant like my full time job… I have just under 1,000 entitites!

Thank you @BrianHanifin – most feedback is when things don’t work so it is great to hear that it works well at least for some :slight_smile:

1 Like

Recent versions of Home Assistant have a much faster logbook so I am not going to update this custom component when it inevitably breaks at some point in the future.

1 Like