SequentMicrosystems_API/scripts/timer.py
2025-01-15 09:26:17 +01:00

22 lines
615 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