Need help with selectattr on hidden

I have the following issue.

I have several lights that I via helpers have put in groups and checket that “hide members”

When using selectattr
´´´ {%- for state in states
|selectattr(‘entity_id’, ‘match’, ‘light’)
|selectattr(‘state’,‘equalto’,‘on’)-%}´´´
I get all lights that are on, however I also get hidden members. Any idea on how I can avoid these hidden members

Using the Yaml: ´´´{% set ns.light= ns.light + (state.name ~ ’ ’ ~ “\n”) %}´´´ in Templade gives nice CR after each light. But using in a card, it is without CR (line shift)

Marinus

{% for state in states.light
| selectattr('state', 'equalto', 'on')
| rejectattr('entity_id', 'is_hidden_entity') | list %}

Hi thks, that was simple, wonder why I could not solve that.