owm.py: check for w['rain']['3h']
[chrisu/seepark.git] / seewasser.py
index 5bf2ce2..922a990 100755 (executable)
@@ -12,6 +12,8 @@ from sqlalchemy import create_engine
 import warnings
 import MySQLdb.cursors
 
+logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
+
 #May 27 21:32 /sys/bus/w1/devices/28-0416a1bab9ff
 #May 27 21:33 /sys/bus/w1/devices/28-0416a1ac66ff
 #May 27 21:35 /sys/bus/w1/devices/28-0516a207a4ff
@@ -109,7 +111,8 @@ def main(configfile, fromcsvfile):
         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))
+        if args.verbose:
+            logging.info('Sensor {}: {:.1f}°C'.format(sensor_id, value))
 
 
 if __name__ == '__main__':