Template Filter?

Dear Community,

I have a question about the templates. I would like to list certain binary_sensors in the template.
{{states.binary_sensor | list }}
This call works as expected. The sensors would be found under states.binary_sensor.lumi_lumi_sensor*. However, the asterisk as a placeholder does not work. Should I define a group beforehand or is there an easier way?

Many thanks for your attention
Sakura

Translated with DeepL Translate: The world's most accurate translator (free version)

Hi, you can also label them, then use

  • label_entities(label_name_or_id) returns the list of entity IDs tied to a given label ID or name.

To list binary sensors with a specific entity ID prefix:

{{ states.binary_sensor|selectattr('entity_id','search','binary_sensor.lumi_lumi_sensor')|list }}
1 Like

Thank you very much. I tried it right away. It was very helpful. Kind regards

1 Like