I have a label called “lamps” that I use in my automation to turn on all lamps at a certain time.
Is there away to do this so that the lamps turn on at slightly different times from each other i.e. there is a random delay before each lamp switches on.
Use a Repeat for Each action with a template to provide the entities that share the label, and a random length delay. The example below will provide a random 10-60 second delay between turning on each item labelled lamps.
The generic service homeassistant.turn_on is used just-in-case, so that the automation will continue to work without issue if you add the label to any light entities in the future.
When I run the above scripts, all except “smartswitch-white-lamp-01” come on.
This is the last switch that I have added to the Lamps group. Configured exactly the same as the others.
Any idea why the loop might stop before this last one is turned on or off?
If I run the below, they all turn off or on (depending on the script)
alias: Switch off all Lamps
sequence:
- service: switch.turn_off
target:
label_id: lamps
data: {}
mode: single
icon: mdi:desk-lamp-off
It’s just like the repeat loop I use for the random sequence, times out or completes before reaching all the lamps. This said the Script stays toggled on for a while i.e. it is running but the last lamp (smartwitch-white-lamp-01) is not affected.