Bewaesserungsanlage/main.py

23 lines
786 B
Python
Raw Normal View History

2022-08-16 03:13:10 +02:00
import threading
import time
from Webserver import Webserver
2022-08-15 23:58:07 +02:00
from ZoneManager import ZoneManager
from SystemSettings import SystemSettings
from FileIO import FileIO
2022-08-17 02:14:53 +02:00
systemSettings = SystemSettings(dataDir="/Data", multiZoneIrrigation=False, defaultAutoIrrigationDuration=10, defaultManualIrrigationDuration=10, defaultManualOffDuration=10, webDurationOptions=[1, 5, 10, 15, 20, 25, 30, 45, 60])
2022-08-16 03:13:10 +02:00
fileIO = FileIO(systemSettings)
zoneManager = ZoneManager(systemSettings=systemSettings, fileIO=fileIO)
webserver = Webserver(zoneManager=zoneManager, port=80)
def cronJobs():
while True:
2022-08-17 02:41:49 +02:00
time.sleep(0.5)
2022-08-16 03:13:10 +02:00
zoneManager.cronJobs()
2022-08-15 23:58:07 +02:00
if __name__ == "__main__":
2022-08-16 03:13:10 +02:00
cronjob_Thread = threading.Thread(target=cronJobs)
cronjob_Thread.start()
webserver.startWebserver()