Changeset - 18ae0de640b9
[Not reviewed]
default
0 1 0
matthewreed - 9 years ago 2016-08-08 20:01:11

Added timezone compensation for EST timezone
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
hydrobot.py
Show inline comments
 
@@ -12,6 +12,7 @@ from influxdb import InfluxDBClient
 
from influxdb import SeriesHelper
 
from apscheduler.schedulers.background import BackgroundScheduler
 
import PID
 
from pytz import timezone
 

	
 
#TODO
 
#fix temperature offsets
 
@@ -147,6 +148,7 @@ class Scheduler:
 
    def __init__(self, canbus):
 
        self.canbus = canbus
 
        self.apscheduler = BackgroundScheduler()
 
        self.apscheduler.configure(timezone=timezone('US/Eastern'))
 
        
 
    def start(self):
 
        self.apscheduler.start()
 
@@ -172,7 +174,7 @@ class Scheduler:
 
                if trigger == 'cron':
 
                    on_job = self.apscheduler.add_job(self.canbus.set_output, trigger, [module, output, 1], day = on_time[0], day_of_week = on_time[1], hour = on_time[2], minute = on_time[3], second = on_time[4])
 
                    off_job = self.apscheduler.add_job(self.canbus.set_output, trigger, [module, output, 0], day = off_time[0], day_of_week = off_time[1], hour = off_time[2], minute = off_time[3], second = off_time[4])
 
                                        
 
                    
 
                    #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)
0 comments (0 inline, 0 general)