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.
