Hello,
I am trying to get the a script done. I should:
- take a cover/entity_id as parameter
- check if it’s state is “closed”
- send an open command
- wait for some seconds
- send a stop command
so far this is working fine.
Now - with the help of the forum search and the manual - I extended this script to handle multible entity_ids. But the problem is now, that I can only check one of the entity state and run the service only on all or on none of the entities. What I actually wanted is, that each cover/entity_id is checked and opened separately.
cover_open_checked:
alias: cover opening if closed
mode: single
sequence:
- condition: template
value_template: "{% for e in entity_id %} {% if loop.first %} {{ is_state( e , 'closed') }} {% else %} {% endif %}{% endfor %}\n"
- data_template:
entity_id: "{{ entity_id | join(', ') }}"
service: cover.open_cover
- delay: 00:00:02
- data_template:
entity_id: "{{ entity_id | join(', ') }}"
service: cover.stop_cover
cover_office_open:
alias: shades open in office
sequence:
- data:
entity_id:
- cover.erdgeschoss_buro_1
- cover.erdgeschoss_buro_2
- cover.erdgeschoss_buro_3
service: script.cover_open_checked
I was not able to concatenate multiple is_state
results for the condition template - e.g. I could make the template result into true and true and true
but I would no longer start the script. Even if this that would work, it would still not solve the overall problem.
The whole sequence needs to be somehow templated - something that seems not to be possible - at least its not an option listed here: https://www.home-assistant.io/docs/scripts/
At that point I am not even sure if this is going to work using just one script or if that I idea needs a completely different solution. Therefore I am out of possible search terms.
would be glad if someone could help here