Help with template counting automations that are off but excluding based on labels

I want to show a number of automations that have been shut off, but I want to exclude some of the experimental ones that I’m working on so I thought I’d use a tag to indicate which ones shouldn’t be counted. I used a label to indicate which ones are experimental so it should be excluded but this

{{ states.automation |  selectattr('state', 'eq', 'off') | rejectattr('attributes.labels', 'in', ['Experimental']) | list | count }}

What am I missing?

I got it down to one line:

{{ states.automation 
  | selectattr('state', 'eq', 'off') 
  | rejectattr('entity_id', 'in', label_entities('Experimental')) 
  | list | count }}
1 Like