Recorder working, but not history nor logbook

Hi community!
I was fed up with losing all my history at every major update because of a broken SQLite database (lack of schema migration?), so I decided to switch to MariaDB. The connection is fine, the account has all rights on the databases and all is well. But since then, the logbook keep saying “No logbook entries found”, and the history component “No state history found”. The recorder seems to work fine, as I have now thousands of entries in the states table of the database.

I don’t see anything wrong in the logs however:

Oct 12 11:12:40 server hass[19361]: 2018-10-12 11:12:40 INFO (MainThread) [homeassistant.loader] Loaded logger from homeassistant.components.logger
Oct 12 11:12:40 server hass[19361]: 2018-10-12 11:12:40 INFO (MainThread) [homeassistant.setup] Setting up logger
Oct 12 11:13:01 server hass[19361]: 2018-10-12 11:13:01 DEBUG (Recorder) [homeassistant.components.recorder] Connected to recorder database
Oct 12 11:13:22 server hass[19361]: 2018-10-12 11:13:22 DEBUG (MainThread) [homeassistant.components.recorder.util] converting 17 rows to native objects took 0.007302s
Oct 12 11:35:40 server hass[2429]: 2018-10-12 11:35:40 DEBUG (Thread-11) [homeassistant.components.history] getting 0 first datapoints took 0.000005s
Oct 12 11:13:22 server hass[19361]: 2018-10-12 11:13:22 DEBUG (MainThread) [homeassistant.components.recorder.util] converting 4 rows to native objects took 0.002553s
Oct 12 11:13:22 server hass[19361]: 2018-10-12 11:13:22 DEBUG (Thread-9) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.023692s

Home-assistant v0.79.3, latest stable MariaDB and latest PIP packages.
Would you happen to see what’s wrong?

Thanks!!

Edit: I tested on PostgreSQL too, and I have the exact same issue

I updated to 0.80, but so far I observe the same issue. FWIW, my config is the following:

recorder:
  db_url: postgresql://@/homeassistant
  purge_keep_days: 180
  purge_interval: 10
  exclude:
    domains:
      - weblink
    entities:
      - sensor.time
      - sensor.date
# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

Nothing weird as far as I can tell!

Solved it. I noticed in the browser console a few 401, on the calls to the history API. Why this one only, I don’t know! I solved the 401 by tuning the reverse-proxy.

Btw, error handling should be improved. Saying “No logbook entries found” is not the same as “Failed to retrieve the history data for the logbook”. But apart from that, keep up the great work!

I also have no history, but dont see a 401 in the console. Can you share with us what you modified in the Reverse Proxy? This might help us troubleshoot also the same issue :slight_smile:

You could try adding this in your configuration.yaml

  use_x_forwarded_for: True
  trusted_proxies:
    - 127.0.0.1
  trusted_networks:
    - 192.168.1.0/24

Just use your network subnet (192.168.x.x/24)

Thanks, already have those and seems like history is a bug in 0.80.2. Downgraded to 0.80.1 and thats working now. But for other people having the issue it is usefull to post the modification :slight_smile:

Yup, started working again in 0.80.3 again after second restart.

I think I’ve a similar issue. Recorder and history are OK but no entries found in the logbook.
No error message in the logs. I’ve catch this in the javascript console:

Failed to load resource: the server responded with a status of 504 ()

My habits is to use an URL like https://mysimpleurltoha.com. I’ve just tries using local IP and this time the logbook show some results after a long long time of computation.

Could it be linked to the reverse proxy (I’m using my Synology NAS) ? If yes any idea how to find a workaround ?

For what its worth I had a similar issue. Turned out to be a time zone issue.
Playing with the logbook range showed events were there, but not being shown as the default filter was wrong.