import time 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 db = DataBaseInflux( url="http://localhost:8086", token="Cw_naEZyvJ3isiAh1P4Eq3TsjcHmzzDFS7SlbKDsS6ZWL04fMEYixWqtNxGThDdG27S9aW5g7FP9eiq5z1rsGA==", org="allmende", bucket="allmende_db" ) 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.device_name, hp.get_data()) db.store_data(shelly.device_name, shelly.get_data()) time.sleep(0.1)