I got a switch in dashboard which can enable all the lights in the garden. Sometimes the fuse will be activated to interrupt the power. When I enable or disable each device individually I do not get the issue. So it looks that I have a high current when enabling all lights together by the switch.
Is it possible to create some code, that when the switch will be enabled, each light in the switch group will be enabled after the next with a delay of 2 seconds? With this scenario I might can fix the issue by reducing the switch-on current.
You could make an automation that triggers the lights in sequence with a 2 second delay between each light. You could also have it trigger at a certain time or by sundown so that you don’t need to do it manually.
you should put my code in a script and then have the dashboard trigger the script.
the script is an entity, so you could have a dashboard card that points to the script as an enttiy.
oh… my code assumes everything is a light… but i notice you have a switch in there. you can use this instead if you have a mix of lights and switches… and as edwin says, your dashboard should only point to the script. it cannot also point to the light and switch entities:
I get the error when I want to save the script: Message malformed: expected dictionary @ data[‘sequence’][0] and No visual editor support for this action
where Gartenlampen is my Label name. I did use a script called switch, and in the code I also tried to use the service name switch.toogle which is the given name when I choose a switch for a new script. but I got the same error.