Hi,
I’m sure I’m using search in a bad way - can’t find a sample that matches my desire to clean up the following:
- alias: sunProtectService
##########################################
trigger:
- platform: state
entity_id: 'input_boolean.sunprotect'
action:
- service: cover.set_cover_position
data:
entity_id: cover.fenster_bad
position: 30
- delay: 0:00:01
- service: cover.set_cover_position
data:
entity_id: cover.fenster_wz
position: 35
- delay: 0:00:01
- service: cover.set_cover_position
data:
entity_id: cover.fenster_ez
position: 30
[..]
I have that in multiple areas (up, down, down_street_earlier, down_sunprotection, …) - and find that it becomes very hard to maintain it this way.
The following is more in line with what looks ‘proper and maintainable’ to me - however I don’t find a way where to start a loop that would run two actions per entity (go to position + delay for a second so not all start at covers at once).
automation:
[..]
action:
- data_template:
input_entity: "[ cover.fenster_bad, cover.fenster_wz, ... ]"
input_pos: 50
service: script.rolladen2pos
script:
rolladen2pos:
############################################
alias: "Rolladen to Position"
sequence:
- service: notify.telegram_edelfull
data_template:
title: 'rolladen2pos'
message: >
Rolladen {{ input_pos }} to Position {{ input_entity.replace("_", "\\_") }}
- delay: 0:00:01
This one kind of works - but calls the script once with all entities - where I’d like to get multiple, independent, sequential calls.
A little nudge to the right direction is appreciated.
ItsMee