I have some automation scripts that perform “actions” using a (dynamic) multi-target assignment, for example “all blinds of area XY” or "all lights of area XY which are turned on.
The actions are invoked quite simultaneous for every target.
Is there a builtin way to add some delay between each target invokation, without rewriting every script using a foreach?
something like
action: light.turn_off
target_delay: 300 //this?
target:
entity_id: |
{% set ccl_lights = label_entities('CentralControlLight')
| select('match', 'light\.')
| list %}
{% set lights_floor = floor_areas('UG')
| map('area_entities')
| sum(start=[])
| select('match', 'light\.')
| unique
| list %}
{% set ccl_lights_floor = set(ccl_lights).intersection(lights_floor) %}
{% set ccl_lights_on = set(ccl_lights_floor)
| select('is_state', 'on')
| list %}
{{ ccl_lights_on | list }}
Reason is, triggering multiple blinds / lights at the same time causes a consumption-spike, which I want to reduce by using some staggered invocation, for example start the movement of a single blind every 300ms or turn of a light every 100ms, so my inverters have more time to ramp up/down avoiding under/overprovisioning of current demand.