# HG changeset patch # User matthewreed # Date 2016-08-07 19:50:12 # Node ID 6ad70cd126b723865c25f2a74257d40f42ac5f0a # Parent 819f9b907aef767f7658d60bccf9abf6639007e5 Set starting output state for timers when starting up diff --git a/hydrobot.py b/hydrobot.py --- a/hydrobot.py +++ b/hydrobot.py @@ -176,11 +176,14 @@ class Scheduler: #evalute the current state of the cron trigger and set output on if needed if on_job.next_run_time > off_job.next_run_time: self.canbus.set_output(module, output, 1) + else: + self.canbus.set_output(module, output, 0) if trigger == 'interval': self.apscheduler.add_job(self.interval_off, trigger, [module, output, section + "_off", section + "_on", on_duration], id = section + "_off", weeks = off_duration[0], days = off_duration[1], hours = off_duration[2], minutes = off_duration[3], seconds = off_duration[4]) timer = self.apscheduler.add_job(self.interval_on, trigger, [module, output, section + "_off", section + "_on", off_duration], id = section + "_on", weeks = on_duration[0], days = on_duration[1], hours = on_duration[2], minutes = on_duration[3], seconds = on_duration[4]) timer.pause() + self.interval_off(module, output, section + "_off", section + "_on", on_duration) if "pid" in section: items = config.items(section)