Label_entities not working

I’m trying to test templating in Devloper Tools → Template, and examples in this forums says things like:

{{
  label_entities('Varme') 
    | list
}}

should work fine, but for me it returns nothing.
I have created a Label called Varme, and assigned to entities.
And would like to list those entities only.

What am I doing wrong?

Thanks

The syntax is correct, are you certain the name is identical to your actual label name? The system is very forgiving with forgetting underscores for spaces and case sensitivity so the name seems to be the culprit.

Thanks for answering, but it does not work. It’s a pretty simple label, too,
Have also tried with lower case only etc, but no

if you pick one of the entities that should show up, and you do:

{{ 'light.entity_name' | labels }}

(replace light.entity_name with a real entity that has the ‘Varme’ label on it. ) what do you get?

you should get something like

['Varme']

if you don’t, the template isn’t the problem… if you do get a label, that’s the label verbatim that you need to use. give that a try and post what you get.

Thanks for answering.
When I type in:
{{ 'climate.entity_name' | labels }}
I get a completely empty list.

Picture of the label creation:
image

image

ah! i think the problem is that you’ve labeled your devices, but not your entities. entities do not automatically get the labels of their devices.

you need to either add that label to the entities you want. or you need to do label_devices to get those devices instead of label_entities

1 Like

That did the trick.
It never occurred to me, or even heard of that there is a difference in labeling devices vs entities.
The device is also an entity, yes?

Thank you very much

No. A device is a collection of entities and services.

For example, A smart plug device may have a switch entity and a power sensor entity associated with it.

1 Like