Module: scheduler

class scheduler.base.Scheduler
addMaintenanceJob(nextRunTime, timeoutCallback, recurrence=0)

nextRunTime - GMT timestamp, timeoutCallback - the method to run, recurrence - when to repeat it, in seconds Returns: An id for the newly added job (for removal and whatnot) Note, if the next nextRunTime needs to be calculated, it’s better to do that in the callback-method, and add a new job from there, instead of using “recurrence”

calculateJobs(jobs)

Calculate nextRunTime for all jobs in the supplied list, order it and assign it to self.jobs

calculateNextRunTime(job)

Calculates nextRunTime for a job, depending on time, weekday and timezone.

calculateRunTimeForDay(runDate, job)

Calculates and returns a timestamp for when this job should be run next. Takes timezone into consideration.

checkNewlyLoadedJob(job)

Checks if any of the jobs (local or initially loaded) should be running right now

fetchLocalJobs()

Fetch local jobs from settings

receiveJobsFromServer(msg)

Receive list of jobs from server, saves to settings and calculate nextRunTimes

receiveOneJobFromServer(msg)

Receive one job from server, add or edit, save to settings and calculate nextRunTime

runJob(*args, **kwargs)

None

Note

Calls to this method are threadsafe.

runMaintenanceJob(*args, **kwargs)

None

Note

Calls to this method are threadsafe.

successfulJobRun(jobId, state, stateValue)

Called when job run was considered successful (acked by Z-Wave or sent away from 433), repeats should still be run