The notebook can be used analyze a copy of the Home Assistant sqlite database to ...
- Get the states with the most updates
- Get the events counts
This data can be used to exclude certain entities in the Home Assistant recorder to reduce the amount of data which is stored in the database to keep it efficient.
More information about the process can be found in the excellent post from Denilson Sá Maia. Most of the SQL queries from the post are used in this notebook.
Thank you Denilson Sá Maia for the great work 🙏
You need a working Jupyter notebook environment with pandas and plotly installed.
The easiest way to get such an environment is Google Colab.
Press the Open in Colab
button at the top of this document and click on Runtime
(Menu Bar) and on Run All
.
If the get_from_gdrive_backup
option in the notebook is True
(which is the default) you well see a popup which will ask for permission to access your Google Drive.
You can use a local installed Jupyter as well. This can be installed via conda or pip.
As frontend you can use Jupyter or VSCode.
Just make a local copy of the notebook and open it in your frontend of choice.
Grab a copy of the Home Assistant sqlite database file home-assistant_v2.db
and put it next to this notebook.
It is also possible to change the path to the db filename in the notebook.
There a various ways to get the database file
- Extract it from you backup tar-file (e.g. Google Drive or Local Server)
- Copy it via
scp
- Use Google Colab with the same account as your backups are stored
The notebook itself is licensed under MIT license.