Access hidden entity status from template?

Hi All,

I’ve a template to select lights with on state which works fine.

 {{ states.light | selectattr('state', 'eq', 'on') |  map(attribute='entity_id') | list }}

I’ve now added some lights in groups and selected that group members should be hidden. The template above returns both the group and the individual entities now. Is there a way to filter out hidden entities?

Thanks!

There is no way to get hidden entities in templates.

Unless you’re talking about the grouped entities, which aren’t hidden… I guess you need to clarify.

I’m talking about hidden entities like this

Which they do appear in the template code I pasted above. I actually don’t want them to appear there or possible filter them out somehow. Any ideas?

Nope, you cannot see that information in templates at this time.

You would have to reject them individually. Effectively a manual process but would give you the desired result. If you aren’t changing which ones are hidden often, it shouldn’t be too bad to setup once.

Got it, thanks for the replies

Is there a feature request on this ? It would really be awesome if there was

2 Likes

Try this:

{{
states.light 
| selectattr('state', 'eq', 'on')
| rejectattr('entity_id', 'is_hidden_entity')
| map(attribute='entity_id')
| list
}}
1 Like