Bewaesserungsanlage/main.py

24 lines
901 B
Python
Raw Permalink 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-27 00:29:22 +02:00
systemSettings = SystemSettings(cronJobFrequency=0.5, 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:
zoneManager.cronJobs()
2022-08-23 14:31:23 +02:00
print("Cronjobs done\nactual Time: " + str(time.time()))
2022-08-25 15:37:54 +02:00
time.sleep(systemSettings.cronJobFrequency)
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()