-for sensorID in sensoren:
- temp = readsensor(sensorID)
- if temp is None:
- print("Fehler bei Sensor{}".format(sensorID))
- error = True
- else:
- print('Sensor {}: {:.1f}°C'.format(sensorID,temp))
+def main():
+ config = configparser.ConfigParser()
+ config.read(os.path.expanduser('~/seewasser.ini'))
+
+ value_type = "Wassertemperatur"
+ for sensor_id, sensor_name in config.items('temperature'):
+ timestamp, value_raw, value = readsensor(sensor_id)
+ writesensordatacsv(config, sensor_id, sensor_name, timestamp, value_type, value_raw, value)
+ writesensordatadb(config, sensor_id, sensor_name, timestamp, value_type, value_raw, value)
+ logging.info('Sensor {}: {:.1f}°C'.format(sensor_id, value))
+