Accuracy of runOnce()?

How accurate is the execution time for “runOnce”? For example, I installed the Sunrise/Sunset app to turn on some outdoor lights I have overnight. I noted the sunrise time from the log when I installed the app (7:13am where I am). This morning, I just happened to be around at that time and I noticed the light was still on… so I kept going about my routine and noticed later that they were off. Looking in the logs, I see the off command was sent to the switch at 7:22am.

I know that runOnce() was called with 7:13am as the scheduled execution time from the watching the log when I installed the app. I also know the handler didn’t actually run until 7:22am. Is this expected behavior? Or should I expect to-the-minute (second?) execution?

Of course in this application, a few minutes is not critical, but some might have an application where it was.

I generally notice pretty accurate scheduling of apps. Now, I’m not going to run Grandma’s life support off SmartThings… it isn’t that accurate, but generally pretty close.

That said, there is times where lag can and does happen. It’s been better of late but there were times where the lag was in terms of minutes. It’s possible this is just a lag thing going on. If you want to test it, I’d do this:

Modify your app to send you a push or text notification right after it sends the command to turn off the light.
Install the notify me when… app tied to this light so you get a notification when this goes off.

Theoretically you should get a notification when the app sends the off command as well as a notification of when the light actually goes off. This should give you an idea of the lag, if any, that’s happening.