shelly hinzugefügt
This commit is contained in:
12
main.py
12
main.py
@@ -3,22 +3,24 @@ from datetime import datetime
|
||||
from data_base_csv import DataBaseCsv
|
||||
from data_base_influx import DataBaseInflux
|
||||
from heat_pump import HeatPump
|
||||
from shelly_pro_3m import ShellyPro3m
|
||||
|
||||
interval = 10 # z.B. alle 10 Sekunden
|
||||
interval = 10
|
||||
|
||||
#db = DataBaseCsv('modbus_log.csv')
|
||||
db = DataBaseInflux(
|
||||
url="http://localhost:8086",
|
||||
token="Cw_naEZyvJ3isiAh1P4Eq3TsjcHmzzDFS7SlbKDsS6ZWL04fMEYixWqtNxGThDdG27S9aW5g7FP9eiq5z1rsGA==",
|
||||
org="allmende",
|
||||
bucket="allmende_db"
|
||||
)
|
||||
hp = HeatPump(ip_address='10.0.0.10')
|
||||
|
||||
hp = HeatPump(device_name='hp_master', ip_address='10.0.0.10')
|
||||
shelly = ShellyPro3m(device_name='wohnung_2_6', ip_address='192.168.1.121')
|
||||
|
||||
while True:
|
||||
now = datetime.now()
|
||||
if now.second % interval == 0 and now.microsecond < 100_000:
|
||||
db.store_data(hp.get_data())
|
||||
|
||||
db.store_data(hp.device_name, hp.get_data())
|
||||
db.store_data(shelly.device_name, shelly.get_data())
|
||||
time.sleep(0.1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user