As before, I’ll go through the different steps of the shortcut.
The shortcut starts with turning the lamp on using the Control Home action.
We then set a Repeat action, and this is the number you’ll change to test the limit. You can start by setting it to 195 times, which would mean that the shortcut will run for just under 10 minutes.
We’ll then add a Wait action which we’ll set to 3 seconds.
Next End Repeat follows.
And finally, we use the Control Home action once again to turn off the light. This step is important, since this is the only indicator we get from the shortcut that it has finished successfully.
It’s important to know that there is a little bit of overhead when running the shortcut. For instance, when I used the number 190 in the repeater, the shortcut should have taken 9 minutes and 30 seconds (190 x 3 seconds), but it took about 9 minutes and 39 seconds.
Is there a reason behind setting the wait timer to exactly 3 seconds? Just out of interest and learning like we spoke about the other day!
Hi Michael,
That’s a good question. I don’t actually have a good reason for it. For the shortcuts where I’m looping while checking if the motion sensor has seen any movement, I always use 3 seconds, since the “motion detected” state is only active for a few (perhaps 5) seconds, and in that case you want to be able to catch it.
In this case my thinking was that there’s a larger chance that a shortcut that only has a wait action that lasts several hundred seconds is more likely to be terminated than one that is actively running, but there’s probably no difference.
Ah yes I see what you mean now, basically your waiting those 3 seconds then checking again for motion so basically you want the sensor to time out so it can effectively check for motion again.
Well, the sensor is constantly checking for motion. But when it does see motion, there’s an “event” which changes the state of the sensor. There are really three separate states it can have: checking for motion, motion detected, and motion not detected. Checking for motion is the default state, motion detected is triggered when motion has been detected and this state stays for about 5 to 8 seconds, or however long continuous motion is seen by the sensor. When it stops detecting motion, the state changes to motion not detected for 5 – 8 seconds, and then it goes back to checking for motion.
In the shortcut where you want the lights to turn off after a certain time after no motion has been detected, you want to control the delay before the lights turn off, but you also want to be able to terminate the shortcut and cancel the lights from turning off in case there is new motion detected. Otherwise, the lights would turn off and then back on again.