SequentMicrosystems_API/scripts/timer.py

22 lines
617 B
Python

from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.interval import IntervalTrigger
from apscheduler.triggers.cron import CronTrigger
import os
scheduler = BackgroundScheduler()
if bool(os.getenv("BACKGROUND_SCRIPTS_RUN", 0)):
print("run")
scheduler.start()
#control speed
#from scripts.speed_controller import rpm_control
#scheduler.add_job(rpm_control, trigger=IntervalTrigger(seconds=0.5))
#control fans
from scripts.fan_controller import fan_control
scheduler.add_job(fan_control, trigger=IntervalTrigger(minutes=1))
#speed_reader
import scripts.speed_reader