A comprehensive documentation site explaining how statistics are generated, stored, and used in Home Assistant. Includes practical SQL query examples for exploring and troubleshooting the database.
https://drcoolzic.github.io/ha-statistics-doc/
| Section | Description |
|---|---|
| Overview | High-level map of all documentation sections |
| Part 1 — Foundational Concepts | Entities, states, the recorder, and how they relate to statistics |
| Part 2 — Statistics Generation | How HA compiles short-term and long-term statistics |
| Part 3 — Working with Statistics | Dashboards, graphs, and UI display |
| Part 4 — Best Practices & Troubleshooting | Choosing state_class, recorder config, common pitfalls |
| Part 5 — Find & Fix Statistics Errors | Detect and repair data gaps, spikes, orphaned entries, and more |
| Appendix 1 — Mysterious Table Fields | Deep dive into created_ts and mean_weight |
| Appendix 2 — Statistics Domains | Statistics from non-sensor domains |
| Quick Reference Guide | Cheat sheet with key concepts and decision tables |
| Glossary | Terminology reference |
| Section | Description |
|---|---|
| States Queries | Querying the states and states_meta tables |
| Statistics Queries | Querying statistics and statistics_short_term tables |
| Error Detection Queries | SQL queries to detect common statistics errors |
| SQL Tips | Useful SQLite/MariaDB tips and techniques |
The site is built with MkDocs using the Material theme.
pip install mkdocs-material
mkdocs serveThen open http://127.0.0.1:8000 in your browser.
This project is licensed under the MIT License.