I know that this thread wasn’t touched for a long time, but as it’s still very valid, I wanted to add a second (my) way for the Analytical approach > Template Editor Method
, as I found the way with Excel and scripts to tedious, especially when one wants to update regularly.
I’m doing an all-out approach with this, as I first exclude everything and include only specific entities. This is done by getting an ordered list of all domain
s to exclude, and a list with all entity_id
s to include.
Enter this in the template editor (developer tools)
logbook:
exclude:
domains:
{% for domain in states | map(attribute="domain") | unique | sort -%}
{{ ' ' }}- {{ domain }}
{% endfor -%}
{{ ' ' }}include:
entities:
{% for entityid in states | map(attribute="entity_id") | sort -%}
{{ ' ' }}- {{ entityid }}
{% endfor %}
This is the version, if you include a file like `logbook.yaml`
If you include a file for logbook and/or recorder, you need different indentations. In this case, use this for the template editor:
exclude:
domains:
{% for domain in states | map(attribute="domain") | unique | sort -%}
{{ ' ' }}- {{ domain }}
{% endfor -%}
include:
entities:
{% for entityid in states | map(attribute="entity_id") | sort -%}
{{ ' ' }}- {{ entityid }}
{% endfor %}
It’s nothing fancy, just indentation, but you know how much that matters in YAML.
Now you should get an already formatted list for your recorder
and logbook
, where you only have to go through the entities you’d like to include.
Copy the list from the right in the template editor and paste it into your editor/add-on/visual studio (whatever you choose to work on your YAML). It should be correctly indented and the only thing you need to do is deleting the lines from the entities you don’t want to include.
Hope this helps some, for me it’s easier than to work with Excel or another table calculation program.
PS: @tom_l If you want me to add this to the first post, please let me know.