Logbook - add 'Hour' to the Period selector - Feature/Enhancement

This is an overall enhancement request for the logbook to be able to pick hours vs. entire days. As you’d guess number of IoT devices is getting larger and more complex thus waiting for minutes for the logbook to open makes it unusable. MariaDB decreased it down to 15 seconds and I’m certainly happy with that. However, it’d be great to be able to use this page w/o a separate DB, etc. I’m using the logbook to quickly make sure automations fire, etc. however, the quickly aspect is not really true :slight_smile: but would be ideal.

Usually I don’t need 1 day to be the default from a common use-case scenario.

Thanks for any consideration!

Not sure why this isn’t getting any more votes, to me this is the most annoying feature of home-assistant. I have around 300 unique entities that are being tracked and and stored in mariadb, which may get updated around once per minute. It takes around one minute to load the logbook, but most of the time I just want to see what happened in the last hour or two. I can manually go through the entries to filter the ones that I don’t really need, but it would take up a lot of time and I would then manually add stuff to either the include or exclude list every time I add a device.

The problem with the current implementation is that the “period” selector is hard coded to days and the backend API also only accepts days as input. This should be relatively easy to change, but I currently don’t have the time to do so. If any one else is interested in implementing different time granularity, these files would need changing:

  • https://github.com/home-assistant/core/blob/10d25c798e861b58f0d286e492b313b0f28e194c/homeassistant/components/logbook/__init__.py
    to support handling of hours (period could be computed in hours instead of days)
  • https://github.com/home-assistant/frontend/blob/903f92f94a40cdec52f196f581343fd09241ee8b/src/panels/logbook/ha-panel-logbook.js
    to add hours to the paper-listbox and change _computeFilterDays to _computeFilterHours
  • to update the api call from frontend to backend (probably not necessary if we just use hours for period instead of days): https://github.com/home-assistant/frontend/blob/903f92f94a40cdec52f196f581343fd09241ee8b/src/panels/logbook/ha-logbook-data.js

Implemented in 0.112

1 Like