Sigh… I had hoped that ST finally fixed the scheduling problem. Obviously not. In the last 3 days/nights my (long-running) smartapp failed to reschedule once each day, hence, stops working. No specific time when it failed. Nothing in the log that indicated a problem.
When working properly the app should run once on the hour then schedule the next run 1 hour later. For unknown reasons, in past 3 days, this rescheduling has failed once each day.
I am seeing major issues lately too. The platform is pooped out again!
1 Like
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
3
Which API are you using? Once time API’s like runIn/runOnce or schedule()?
Also I’ve noticed by looking at the SmartApp details sometimes the method is “called” by the scheduler but it just never executes. So if you’re daisy chaining it will fail to schedule the next run time as it never executes even though the history shows that the function was “called” (not).
def logData() {
.
.
.
.
.
.
// Call scheduledLog before SendHTTP in case there is a server error.
scheduledLog()
sendHttp(tableString)
}
/* ------------------------------------------------------------------------------------------------- */
def scheduledLog() {
def timeMs=now() + 3600000
def date = new Date(timeMs)
def m = date.format('m').toInteger() * 60
def s = date.format('s').toInteger()
def onTheHour= timeMs - (m + s) * 1000
date = new Date(onTheHour)
sendNotificationEvent( "Next runOnce() is scheduled for $date")
runOnce(date, logData)
}
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
7
Right that’s what was I alluding to earlier, you’re daisy chaining the runOnce calls. The new Ticker is far from perfect when it comes to runOnce schedules, like I had mentioned, sometimes it will pretend to call the function but actually never call it so the net effect is that your timer chain is broken. ST also recommends that once doesn’t daisy chain timer, I guess they know about the dropped schedule issue.
A couple of things I’ve noticed, runIn works better than runOnce for short period of time. In your case I would call runEvery1Hour(logData) from the updated/initialize function of the smartApp and remove the scheduledLog() function entirely. When you’re done with the logData() function call unschedule(logData) and you’ve cleaned up.
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
8
If you want to verify when it broke open your SmartApp details under My Location and see the execution history.
Does this allow setting the actual time. The logdata must be executed on the hour to record my Home Energy Meter readings as these numbers are compared to actual meter readinfg by my utility company.
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
10
Well It didnt return any errors when I updated tghe app. Now to wait for 20 minutes to see if it actually runs
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
15
You can see what’s scheduled. IDE → My Location → List SmartApps, → Locate your SmartApp and click on it → Scroll down to scheduled events. See what time it’s scheduled to run and what type of timer it is.
However, based on the notifications, nothing actually happened during that run. At the start and end of the function called by schedule() I placed SendNotification to log what actually happened during the hourly run. Note that there was no entry for 2PM run.
BOOOOH!!! Scheduled apps failing like there is no tomorrow. One app that runs every hour (at least its supposed to) failed for numerous hours last night.
Job History
Handler Scheduled Time Actual Time Delay (msec) Execution (msec)
logData 2016-07-15 8:00:25 AM EDT 2016-07-15 8:00:55.429 AM EDT 30429 13658
logData 2016-07-15 6:00:25 AM EDT 2016-07-15 6:00:50.304 AM EDT 25304 5978
logData 2016-07-15 5:00:25 AM EDT 2016-07-15 5:00:53.746 AM EDT 28746 11094
logData 2016-07-15 4:00:25 AM EDT 2016-07-15 4:00:56.611 AM EDT 31611 16616
logData 2016-07-15 3:00:25 AM EDT 2016-07-15 3:00:57.679 AM EDT 32679 12203
logData 2016-07-15 2:00:25 AM EDT 2016-07-15 2:01:00.968 AM EDT 35968 16131
logData 2016-07-15 1:00:25 AM EDT 2016-07-15 1:00:58.719 AM EDT 33719 10005
logData 2016-07-15 12:00:25 AM EDT 2016-07-15 12:00:54.505 AM EDT 29505 101825
logData 2016-07-14 9:00:25 PM EDT 2016-07-14 9:00:59.582 PM EDT 34582 9988
logData 2016-07-14 8:00:25 PM EDT 2016-07-14 8:00:55.425 PM EDT 30425 16136