No logbook entries found for previous days

I have history entries going back a few days but when I check the logbook it only shows today’s entries. Nothing from the past.

Here’s my relevant configs:

####################################################
#                                                  #
#                     Enables                      #
#                                                  #
####################################################
logger:
  default: error
  logs:
    homeassistant.components.media_player.firetv: fatal
    homeassistant.components.media_player.cast: fatal
    homeassistant.components.cameras: fatal
    homeassistant.components.wink: critical
frontend:
history:
discovery:
sun:
logbook:
updater:
  reporting: false
recorder:
  # Delete events and states older than 2 weeks
  purge_days: 14
  db_url: !secret db_url
  exclude:
    domains:
      - updater

I’m using MySQL for the db and like I said, history is working fine. Any ideas?

Update: Did some more checking and I do have entries for 2/5/17. But nothing for any of the days between today and 1/26/17 except for 2/5/17…

I’m fighting with this more then week. Initially I thought it was Google Calendar. Then WU with lang option. But now I can’t say why my logbook not updating. It can show entities for half of a day and then stop update. Rebooting OS, restarting HA, clearing cache nothing helps. But if you switch back to sql lite it start showing. It makes me feel like logbook sql query not matching conditions or even not executed.

2 Likes

You may be on to something here. Hopefully we can get some more users to check in.

1 Like

I think I’ve found solution. Do you use friendly name or entity values in any other language than English?

1 Like

No. I barely speak English well enough. LOL

Seriously though, I only speak US English and have no odd characters in any of my friendly names that I know of. But that was an idea.

For me it seems that sql client can’t process non English characters. After upgrade to 0.38.1 I had a lot of errors in the log with can’t insert some values to db. This was exactly non English characters. I’ve checked db. Character set was UTF8 and collation was latin1. It brings me idea that mysql can’t convert charset in proper way. I change global server parameters to UTF8 and collation to utf8_unicode. I’ve also set parameters for connection in same way. Now I have clear log and my logbook updating.

1 Like

I doubt that I have any non English characters in my friendly names. I do have one or two non UTF8 instances, but I have them set up with the proper UTF8 escape sequences otherwise HA wouldn’t load at all.

But this is something that I’ll have to look into further. I’ll need to set up phpMySQL first but thanks for this idea!

All settings can be done via command line. To keep settings permanently you’ll need to add some lines in my.cfn.
Maybe several convertations brings some issues (front-end, sql client, server connection, db collation). I’m not mysql expert.

Yeah, me either. I know my way around phpMySQL from my web dev days, so I think I would be more comfortable running in that environment. Would give me a chance to do maintenance as well.

@Lapatoc - found this from an issue report on Github - am trying this for now as I think it will solve both of our issues.

I’ve already tried this option (using charset setting in connection string). It also brings errors for me. The problem is that server also tries to convert charset according to its global settings. By default it’s uft8 and collation latin1. For you it could work cause you are using only English characters. I have 3 template sensors with Russian character. I had to recreate db with unicode collation and config server parameters to use UTF8 and unicode collation on server level, db level and connection level.

Sorry, I hadn’t considered that. I need to learn a bit more about MySQL and non-English characters.

Hi there!
I have same trouble with history after 0.38.1 upgrade.
It works ok before update with MySQL and russian characters.
I have no options with charsets in my.cnf and database charset is ‘utf8’.
And now I think that the trouble is in frontend, because I have records in database for past 7 days (like I set in config), but history is showing up just present day.

I’ve set utf8_unicode collation for database and server and now everything works fine.

1 Like

Adding the UTF8 qualifier to the end of my db URL seems to have solved my issues.

mysql://user:pass@hostname/db_name?charset=utf8

2 Likes

Looks like this fixed my problem with history and logbook as well

Alas… Did not fix it for me… Only for a short while… After x-time it’s b0rken again