Populate Card by Friendly Name

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 :rofl: ) 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)

Thanks in advance

tried this in my template editor, and though it gives a nice overview, I don’t really understand it :wink: Isn’t this a list of all entities in the given domain? What could you use that for?

wat exactly is the output showing us here?

Because,

And I use this to populate that so that when …

it’s not cluttered up with stuff I’ve already dealt with (it’s used as a check and generally to sweep stuff under the rug)

1 Like

I see, clever. You use everything that way :wink:

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 %}
...
1 Like

You Sir, are a Gentleman and a Scholar !

I Thank You !

:beers:

-
{% 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 :rofl: ) (The ‘count’ wasn’t used - I was just seeing how many trees I’d cut down :smiley: )

The best bit is that; I just reuse the snipets to wipe clean and re-populate should I add anything to my system

1 Like

Apologies for the follow up question rather than a new topic, but can we filter by ‘unused’ status at all ?
(The frontend does it so … ??? )

Do you mean “unused”, as in not used in the frontend? If so, I have no idea.

1 Like

Yep I did, Thanks anyway