I’ve just migrated EVERY thing from one HA instance to another, adding and changing things as I went.
I use the unused entities to see what I need to do with any new entities to check that the decks are clear.
I have a ‘view’ just for hiding stuff away. I generally populate it (from the template editor) using : -
-
{% for state in states.automation -%}
{{ ' - entity: ' ~ state.entity_id }}
{{ '' }}
{%- endfor %}
Pasting the result into my yaml (same for scripts)
So inspired by a recent topic : -
I thought I’d do the same with the ‘other entities’ I want to hide, but here it becomes tricky.
The main thing they have in common is that they ALL have a friendly name Starting with "Null "
But, for other uses, they may have the word “Switch” somewhere in the friendly name. (This is just an example of something to search for).
Using the two above examples I thought I’d hack the two together and create my ‘yaml scraps’.
The brickwall I’ve hit proves to me that I don’t actually understand the syntax well enough to do that.
The question was split deliberately as the first 5 chars should be relatively easy (so much for what I thought ) and the second (‘Switch’ somewhere in) - … - I have no clue at all
Can someone explain the required syntax and see if that lights a candle somewhere in the blacked out aircraft hanger that I’m working in ? (even if it’s just a reference)
tried this in my template editor, and though it gives a nice overview, I don’t really understand it Isn’t this a list of all entities in the given domain? What could you use that for?
I don’t think I understand what you’re asking for. Are you trying to output only entities that have ‘Switch’ (for example) somewhere in their friendly name? Maybe something like this:
{% for state in states.automation
if 'Switch' in state.attributes.friendly_name %}
...
-
{% for state in states
if 'Null ' in state.attributes.friendly_name %}
{{ ' - entity: ' ~ state.entity_id }}
{%- endfor %}
Got me : -
{% set ns = namespace(num=0) %}
{% for state in states
if 'Null ' in state.attributes.friendly_name %}
{% set ns.num = ns.num + 1 %}
{%- endfor %}
{{ ns.num }}
"137" entities off my unused entities list (I know I could probably have used .count in there somewhere but the ‘quick and dirty’ works ) (The ‘count’ wasn’t used - I was just seeing how many trees I’d cut down )
The best bit is that; I just reuse the snipets to wipe clean and re-populate should I add anything to my system