18 lines
386 B
Python
18 lines
386 B
Python
import time
|
|
from datetime import datetime
|
|
from data_base_csv import DataBaseCsv
|
|
from heat_pump import HeatPump
|
|
|
|
interval = 10 # z.B. alle 10 Sekunden
|
|
|
|
db = DataBaseCsv('modbus_log.csv')
|
|
hp = HeatPump(ip_address='10.0.0.10')
|
|
|
|
while True:
|
|
now = datetime.now()
|
|
if now.second % interval == 0 and now.microsecond < 100_000:
|
|
db.store_data(hp.get_data())
|
|
|
|
time.sleep(0.1)
|
|
|