Automation of group: Group devices each depending on different switch/entity

Hi all,

I just migrated from openHab a couple of weeks ago. The basics are running smooth and I am happy.

But I can recreate on thing I had in OH.

I have an automation that shuts down every cover/blind at a certain time.
Now I would like to exclude single cover/blinds from closing, depending on a switch per cover/blind. (switch has similar name as the cover/blind)
There is a configuration page with one switch per cover/blind.

e.g. my wife can exclude a cover/blind from automated closing with a switch when there a guests or something.

I played a round with
{% for entity_id in states.group.all_covers.attributes.entity_id %}
and
{{ expand('group.all_covers')|selectattr(...

I don’t know how to solve this or continue.

Is there a taxonomy /system for your switch /blind naming?

If so what?

You’re already through the hardest part - you have a list to iterate. Now you just need to filter out any that are x, y, z.

If your switching has similar names to the corresponding blinds you can use a similar technique to get a list of the switches that are on and then use something like replace() to work out it’s matching blind and then use that as a filter for the original list. (sorry don’t have a sample but I think you can follow)

Basically two lists one of blinds that are open. One of switches on. Then filter the blind open list using the contents of your switches on list in your loop. Use filtered list as your target for the service call.

Hi NathanCu,

thank you.
Yes, the blinds are named over.rollo_*roomname and the switches are named input_boolean.rollo_roomname_switch.

I am currently trying it this way:

action:
  - repeat:
      count: "{{ expand(\"cover.rollo_group\") | length() }}"
      sequence:
        - service: script.test
          data:
            cover_entity: "{{ expand(\"group.switch_group\")[repeat.index].entity_id }}"
            switch_entity: "{{ expand(\"group.rollo_group\")[repeat.index].entity_id }}"

And I am trying to create a script with two input parameter. One for the condition switch, one for the blind.

But a) is it not working for whatever reason and b) I dont know if the arrays are always sorted the same.
So there is probably a better way. :slight_smile: