Scheduled Jobs After Hub Reboot

I have an app that schedules a job at a user set interval. (i.e. log data to a remote file every 120s) After a hub reboot this scheduled job (which scheduled time has expired) will no longer run.

How do I handle schedules that can survive a hub reboot?

If you have control of the code, subscribe to the systemStart event and determine whether you need to restart. For device drivers add the Initialize capability and use the initialize method to do the same thing.

2 Likes

That sounds what I am looking for.
A subscribe event for a device would look like:
subscribe(theSensor, "power", powerInputHandler)

How does a systemStart statement look?
subscribe(systemStart, "something", systemStartHandler)
Or
subscribe(something, "systemStart", systemStartHandler)

Never mind. I found it
subscribe(location, "systemStart", hubRestartHandler)

2 Likes