Forcing group of devices to bet updated sequentially

Hi there,

I have 3 blinds in my living room.

I can set position and open/close fully but no stop by default. Since they are actually shutters, I created a custom script that takes a position and 3 options of tilt position (open/half/closed) and played with current position, wished position+tilt orientation to adjust the only state I can change, the position to achieve the end goal. That works quite fine.

Now, in order to get HA show me additional buttons with the default "cover" widget when I select one of those blinds, I created a template for each blind like that:

- cover:
    - name: Store salon
      state: "{{ states('cover.store_salon_salon') }}"
      device_class: shutter
      position: "{{ state_attr('cover.store_salon_salon', 'current_position') }}"
      set_cover_position:
        action: cover.set_cover_position
        data:
          position: "{{ position }}"
        target:
          entity_id: cover.store_salon_salon
      set_cover_tilt_position:
        action: script.set_cover_position_and_tilt
        data:
          cover: cover.store_salon_salon
          position: "{{ state_attr('cover.store_salon_salon', 'current_position') - 1 }}"
          tilt: "{% if tilt < 25 %}Closed{% elif tilt <= 75 %}Half-closed{% else %}Open{% endif %}"
      stop_cover:
        action: cover.set_cover_position
        data:
          position: "{{ state_attr('cover.store_salon_salon', 'current_position') }}"
        target:
          entity_id: cover.store_salon_salon

Now my first and most important question: I created a group of devices that has my 3 living room blinds as a whole, allowing me to work on all of them "at once". This shows me nice buttons in the dashboard:

Changing the position of the group works fine since the blinds get their new position and move asynchronously.

Changing the tilt of the group however fails. My dedicated script script.set_cover_position_and_tilt is supposed to take 1 single cover as argument (+position and tilt) and play with 1-3 changes of position until the end state is reached. It does that synchronously and is not configured to be invoked a second time if still running. And that's where the problem lies imho, only 1 out of the 3 blinds is moved to new tilt position.

Q1: Should I allow the script to be run multiple times to fix that issue of the group of covers not working, should I instead rework the script to allow a group of cover to be passed as parameter and then loop over the children? If so, how to detect that's a group and not a single cover? Or is there another way?

Q2: UI question: when I have a group of covers, and just throw the entity into my dashboard, I get name of the group, up/stop/down buttons, just like my (templated) covers. But the more info action shows additional helper buttons to change the position to 0%, 25%, 75% or 100% and the same for the tilt. I miss that for my templated covers. Which setting am I supposed to use?

Bonus Q: is there a way to change the more-action popup and get 3 custom tilt instead? Like Open/Half/Closed or 0% / 50% and 100%. Not a big deal, just out of curiosity.

Thanks in advance.

As often, asking for help forces us to clearly describe the problem, and I found the solution for my Q1: I changed the mode of my script to "queued" instead of the default "single" and now when I change the tilt of my group, all 3 covers change one after another :slight_smile:

(keeping topic open for a while, in case I find myself answers to other questions or if someone knows and answers)

2 Likes

Automation mode parallel should work as well, if you don't want the sequential behaviour. It won't affect the execution of your tilt script. Just make sure you have the same mode set on your script too.

Yes, parallel should work as well, I agree, just would have the possible side effect of allowing concurrent changes on same entity if for any reason something, or someone triggers the script multiple times with the same entity. Sequentially is thus safer, although lasts longer.

There's no way customizing the more-info popup, thus my other questions make little sense. Only way I found to get the preset position/tilt would be to create a group out of a single cover, that should logically work. Not that pretty, but would logically work.

But instead I'll go another way and try to get my dashboard show directly those little presets, without having to open the complete more-info popup, as this will be much more UX friendly in the end.