Solution HAstats
Arve edited this page Sep 1, 2023
·
19 revisions
- I'm actually rather fond of numbers and looking at development through history of a journey from an number perspective
- So I googled a bit, and found something I found useful, and created a 'solution' for hastats. And then split it into a few sub-solutions just for structure.
- https://community.home-assistant.io/t/lazy-mans-entity-count-something-screwy/174886
- Erlend Sellie's notions of "+10' lines config" - trigger "how big is mine?" - and if I end up with +400 automations - I can look back and see when it happened ;)
Click to unfold list of booring requirements, tips etc
- HACS: Lovelace-Mushroom card-package
- HACS: browser mod - for popup-functionality
- HACS: Start_time
- HACS: custom:tabbed-card
- HACS: custom:auto-entities
- HACS: custom:history-explorer-card
- Packages-folder, to copy entire yaml-config in one file
-
YAML-dashboard - easy share config, can use !include and re-use cards
- as an option you can copy dashboard-config to UI-dashboard/card - but not if !include is used,,
(because HA-team is constantly adding new functionality/domains,, it is useful to get to check/verify that we actually got all configured with sensors,,,)
_____________________________________________________________________
Stats of how many entities pr domain are in my HA-instance, by ArveVM
# check ONE specific domain:
Automations = {{ states.automation | count}}
# check ALL domain:
{%- for domain in states | map(attribute='domain') | unique %}
{{ domain ~ 's : ' ~ states[domain] | count }}
{%- endfor %}
{{ ' Total: ' ~ states | count }}
# check ALL domain (sorted, but with lines between :( ):
{% for domain in states | map(attribute='domain') | unique | sort %}
{{ domain ~ 's : ' ~ states[domain] | count }}
{% endfor %}
{{ ' Total: ' ~ states | count }}
- HAstats-main - Gather all sub-solutions in one card. Tabbed card with sub-solutions on each tab. One tab with reference to this GitHub-repo for documentation-purposes
- HAstats-Integrations - Counter of integrations loaded. Graphed long term history. PopUp with list of all current integrations, with load-times at startup/reload|
- HAstats-Enteties By Domain - Counter of entities pr domain. Grouped and presented 5 most "important". Graphed long term history. PopUp with list of all current integrations, with load-times at startup/reload.
- HAstats Yaml line count - Count yaml-lines for config and dashboard.
- HAstats-DB - Track size of Recorder DataBase.
- Created sensors to count different KPI's of my HA-installations "growth". Added sensors as long term statistics - so we can see (and graph) long term trends
- Adding sub-solutions for each type of stats, so that it is easier to grasp concept of each "kpi-group"
- Adding card for each sub-solution
- Adding tabbed card to combine all sub-solutions in one card - with link to documentation.
- and a chip to easily place link on dashboard.
Card/chip preview | Card | Config | Use case(s) |
---|---|---|---|
insert card-picture | insert card-link | link to yaml-config | list use-cases - Link to Solution documentation |
HAstats-card | n/a | - Overview of all cards in a tabbed-card - Link to Solution documentation |
- Sub-solution, own card and config-yaml
- Start-time integration gives sensor with attributes of all loaded integration and their "startup-time".
- Using history-explorer-graph with long-term statistics enabled, so the configured sensor with long term statistics enabled are visible.
Card/chip preview | Card | Config | Use case(s) |
---|---|---|---|
HAstats_integrations_card | HAstats_integrations.yaml | - view development in number of integrations - click to list all integrations |
|
Popup "Integrations by startup-time" | - list all integrations - see startup-times (dependencies will heavily skew this!!) |
- Sub-solution, own card and config-yaml
- Manually created sensors to count entities pr respective domains.
- Using history-explorer-graph with long-term statistics enabled, so the configured sensor with long term statistics enabled are visible.
Card/chip preview | Card | Config | Use case(s) |
---|---|---|---|
HAstats_ebd_card | hastats_ebd.yaml | - Overview of count in entities - click for details |
|
Popup "Total" | |||
Popup "Sensors" | |||
Popup "Automations" | |||
etc on scripts and lights |
NB; sensor.hastats_ebd_total_checksum - counts sum of grouped-sensors in sensors against total number of sensors and if not 0 then you are missing sensor-count for one "entity-type" - look in troubleshooting for code
- Sub-solution, own card and config-yaml
- Organized yaml-config in separate folder, and the same with Dashboard
- Manually created sensors to count yaml-lines pr respective folders.
- Using history-explorer-graph with long-term statistics enabled, so the configured sensor with long term statistics enabled are visible.
- Please note that YAML-count includes empty lines and comments,,, but I'll further invest in using wiki and not config/dashboard-yaml for comments,, so it will get realistic sometime in the future.
Card/chip preview | Card | Config | Use case(s) |
---|---|---|---|
HAstats_yaml_lines_card | hastats_yaml_lines.yaml | - see development in config/dashboard #lines |
- Sub-solution, own card and config-yaml
- Created sensor to monitor db-size
- Using history-explorer-graph with long-term statistics enabled, so the configured sensor with long term statistics enabled are visible.
Card/chip preview | Card | Config | Use case(s) |
---|---|---|---|
HAstats_db_card | hastats_db.yaml | view development in: - DB-size - states - longterm-statistics - short-term-statistics |
- might want to move the system_monitor.yaml sensors here (as there is no config of the integration)
- change 'float(default=0)' to 'float(0)' - no reason to keep the default ?
- change to monthly graphs when I get several months of data (or just keep floating line?? )
- Aug 2023: Improved card, better overview, improved solution documentation
- Sept 2022: Initial setup
1.0 Disclaimer
1.1 Mentors and Inspirators
1.2 Config Principle
1.3 Current Setup
1.4 The journey
2.1-HA base configuration
2.2 HA Presentation
2.3 HA Functionality
3-Solutions
3.1 General solutions
3.2 Area-specific solutions
3.3 Backend-specific solutions
Self-hosting:
- insert about server/storage/virtualization
- and restore/Backup
- insert about network