-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (25 loc) · 833 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import threading
from water import Water
from communication import Communication
from db import Connection
from sensoren import Sensoren
import time
from apiMain import start
#com = Communication("RPI", "192.168.2.156
com = Communication("RPI", "0.0.0.0")
sensoren = Sensoren(pinRain=22, pinVent1=17, pinVent2=27)
water = Water(com, sensoren)
db = Connection(host="localhost", user="adminLukas", password="IbdtLmmB.11", database="sensor_data")
t_com = threading.Thread(target=com.server)
t_sensoren = threading.Thread(target=sensoren.update_data)
t_water = threading.Thread(target=water.main)
t_api = threading.Thread(target=start)
if __name__ == '__main__':
print("Starting")
t_com.start()
t_sensoren.start()
t_water.start()
t_api.start()
while True:
db.save_data()
time.sleep(300)