# Read voltage voltage = vcc.read() # still to be done using RTC buckets # need to figure out previous voltage value to eliminate rogue values # if (voltage > 1.5 * voltage_old): # print("Bereinigt! voltage was =", voltage, "set to =", end='') # voltage = voltage_old # print(voltage) # Read temperature for rom in roms: DS.convert_temp() time.sleep_ms(750) temp = str(DS.read_temp(rom)) # Send values through MQTT print("Connecting to MQTT") c.status = c.connect() c.subscribe("temp") c.subscribe("voltage") c.subscribe("stop", qos=2) print("Publishing temperature", temp, " and voltage", voltage) c.publish("temp", temp) c.publish("voltage", str(voltage)) c.check_msg() print("nach MQTT Nachrichten geguckt!") if RUN == False: sys.exit() c.disconnect() print("Disconnected from MQTT")