I am pretty new to home assistant, so please be nice in case this is the wrong category or sth.
I’m a little bit exhausted here. Hopefully I’m not naively searching for so
### What is my goal ###
I want a dedicated list for exclusions where I filter out all light groups / single bulbs inside a multi bulb lamp / etc. / etc. Therefore I can’t just filter out groups…
This is going to be my approach for all “count active” entities
.
## nice to have ##
each list of exclusions would be in a seperate yaml file for organization purposes.
.
# what I already have #
This works pretty great!! But returns all unwanted entities as well
#####
# Count active lights
#####
platform: template
sensors:
lights_1st_floor:
friendly_name: 'active lights'
unique_id: active_lights
value_template: >
{%- set search_state = 'on' %}
{{ states.light
|selectattr('state','eq',search_state)
|list|length}}
.
THIS doesn’t work. Why??
#####
# Count active lights
#####
platform: template
sensors:
lights_1st_floor:
friendly_name: 'active lights'
unique_id: active_lights
value_template: >
{%- set search_state = 'off' %}
{%- set exclude_search = [
light.schlafzimmer_1,
light.schlafzimmer_2,
light.hue_white_candle_1,
light.hue_white_candle_2,
light.alle_lichter,
] %}
{{states.light
|selectattr('state','eq',search_state)
|rejectattr('entity_id','eq',exlclude_search)
|list|length}}
Thanks in advance!
Greetings from germany