I’m trying to access my Hass.io Home Assistant database, but I only have this text in the home-assistant_v2.db file is:
‘utf-8’ codec can’t decode byte 0xea in position 31: invalid continuation byte
Any idea how to identify what the problem might be? I have tried looking at any files I might have edited, but can’t see that anything on a line 31 should be “foreign”.
My recorder in configuration.yaml is: recorder: include: entities: - binary_sensor.windows_pc - media_player.living_room_tv
I want to access the database in Home Assistant, so I can transfer/export the data and check it out in a dedicated program instead.
Appreciate any help and suggestions for how to fix the UTF-8 error.
Of course, there is entirely the risk that I haven’t fully understood the recorder/db yet, but hope not!
You have to use a database browser to look at the database, you can’t open it in a text editor. Assuming you’re using the default database (SQLite) this is an example of one such tool: https://sqlitebrowser.org/
Download the database to a machine that you have a database browser installed on and you can look at it there.
If you are looking to do this programatically, you’ll want to switch over to a database engine that is more suited to that (MySql/MariaDB, Postgres, SQL Server, etc).
Okay, so turns out that I didn’t actually understand the database-part of HA… Downloading and opening the v2.db gave me exactly what I wanted. It looks a little different to the databases that I am used to, but looks workable.
On the bright side, my recorder code seems to work, as the database only has data from my binary sensor and media player from about when I changed the recorder
I had to delete my home-assistant_v2.db file a few times now, since it was not displaying history graphs annymore after snapshot restoration.
But now I’ve noticed that my home-assistant_v2.db file mentions “'utf-8’ codec can’t decode byte 0xc1 in position 99: invalid start byte” in the editor.
I got this error today. Journalctl shows (journalctl -u [email protected] --since today):
raspberrypi hass[722]: 2021-01-01 11:52:13 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: 'utf-8' codec can't decode byte 0xc3 in position 1117: invalid continuation byte.
I have experimented with some shell/vim customizations on the Pi recently and I’ve also been using xfce-terminal instead of PuTTY, and I seem to have some issue with utf-8 compatibility… I’m running Home Assistant on MariaDB and I figured surely it can’t be a database issue.
I got the error fixed for now by removing these � characters in configuration.yaml, which I could see in my own comments instead of ä’s.
Edit: Have you checked your sensor values if they get correctly encoded? Are there letters such as è or å in the sensor data.