2 or more in a Group

I’m trying to figure out a neat way, or maybe something out of the box that I’m unaware of, to change group status to “on” when 2 or more devices in that group are “on”.
As far as I know, that can be done with either “one or more” or “all” but is there a way to do it with “2 and more” This is intended to be used as a trigger if any of those devices change state so it doesn’t have to be a group per se (although I think that would be cleanest implementation)

You can’t do that as such, but you could use a template to count how many things are on in that group. Something like:

{{ expand('group.whatever') | selectattr('state','eq','on') | list | count }}

You could use that in a template trigger

- platform: template
  value_template: >-
    {{ (expand('group.whatever') | selectattr('state','eq','on') | list | count) > 1 }}
1 Like

That’s great:) Thank you