Hi all,
For controlling my shutters I use shelly 2PM’s. I have created helpers to group them according to my needs.
But I was not so happy with the automation especially in terms of centralised opening/closing of all shutters. I didn’t like the fact that with a central group/helper all the shellies switch even though some of the shutters may already be in the end position.
I have found a way to open only the shutters that are closed or close only those that are open using two scripts and two dynamic groups and would like to share it with you:
alias: Close all open shutters
sequence:
- condition: template
value_template: >-
{{ expand('cover.shutters_zentral') | selectattr('state','equalto',
'open') | map(attribute='entity_id') | list | length >= 1 }}
- data_template:
object_id: all_open_shutters
entities: >
{{ expand('cover.shutters_zentral') | selectattr('state','equalto',
'open') | map(attribute='entity_id') | list }}
action: group.set
- action: cover.close_cover
metadata: {}
data: {}
target:
entity_id: group.all_open_shutters
description: Closes all open shutters
icon: mdi:window-shutter
If there’s also an easier way, I’m all ears. Sometimes I complicate things.