How can I add a delay between the hue.on and hue.off commands? I’ve tried using delay(), wait(), await(), and runIn(), but the first three give me an error at runtime and the runIn() never seems to actually run.
If you don’t mind adding additional complexity, Simple Rules Engine (AKA, simpleRuleBuilder) can do that. Unfortunately it’s a Web-only oAuth app, so you can’t build the delay directly within SmartThings. It is quick executing though.
The runIn() delay is in seconds, not milliseconds like delay(). I just checked your code and the commented out example using runIn had 10000, which would equate to 2 hours 45 minutes or so. Maybe that’s why it never seemed to run? (Sorry if I just picked up on old code.)
Also, I’m not sure if the code block waits for runIn() before moving on to the next statements. I think it will continue to process the rest of the code, so keep that in mind.