Hello to all, I have a schedule I am trying to create for a Christmas village where a skating pond turns on at 4:30 pm, then runs for 15 minutes and then stays off for 45 minutes (to prevent motor burnout on this ancient toy), and then repeats. I created a routine with those specific minute delays to then end at 9:30 pm. I attached a screenshot for clarity. When I tested it and manually ran the routine, and let it run at the set time, it basically ignored all the delays and turned the device (toy) on and off repeatedly, and rapidly, in seconds.
Can anyone tell me why this happened?
And am I barking up the wrong tree with this type of routine to get what I want done?
Because SmartThings delays inside a single routine are not “blocking timers”.
They are queue instructions, and when the automation framework restarts/evaluates state, those delay objects can collapse or execute at once. This is especially common when:
The routine is triggered manually
The routine includes the same device multiple times
The routine repeats timing steps
There is a hub/cloud sync event while it runs (very common)
SmartThings does not support looping automations in a single routine.
Assuming you have a ST hub, you can create simulated loops using the 3rd party Edge driver found here. Create two timers, one to count the on duration and one to count the off during. Create a few Routines like this:
If 4:30pm
then
Turn on pond
Turn on On-Timer
If On-timer is => 15 mins
Turn off pond
Turn on Off-Timer
Turn off On-Timer
Reset On-Timer
If Off-Timer is => 45 mins
Turn on pond
Turn on On-Timer
Turn off Off-Timer
Reset Off-timer
If 9:30pm
Turn off pond
Turn off On-Timer
Turn off Off-Timer
Reset On-Timer
Reset Off-Timer
I have something similar to run an air freshener. I first created a manual routine to turn on the air freshener switch for an hour. Then I created an automatic routine to start at 6 am, runs the manual routine, delays for 4 hours, and then runs the manual routine again. Continue repeating this until the desired end time. I went this route as I have a different timing for the weekends and this allows me to have different start times and delays for the weekend.
If you follow this you need to remember for the delay you need to account for the duration of your device on time plus your delay. So in the example you gave your delay would be 1 hour (15 min on + 45 min delay)
Thank you for this suggestion, it is cool to see how many things TAustin has created. I’m currently experimenting with his virtual devices.
I ended up simply creating 4 routines within the Smart lighting app, which I luckily still have in my app. I realize most of that app is within Automations now, but it allows me to group all my lighting routines in one area (app), so I like having it and using it organizationally.
Anyway, I created several on/off routines every hour, basically. Not sophisticated, barely elegant, but easy.
I’d go with one “motor protect” routine that does nothing but “if motor has been on for 15 minutes, turn it off”, and then use a schedule to turn it on at the times you want it on.
That way it’ll always turn off after 15 minutes, regardless of who or what turned it on.