use generic variables in -no-pm code too
[EVA-2020-02-2.git] / examples / luftdaten.py
index b7f0565e21f2e0ea48edbc97954ae381c01b61f2..c5b03873356bbdca7a808ab0f29729e6f4b88501 100755 (executable)
@@ -62,7 +62,7 @@ def read_values():
         values["P2"] = str(pm_values.pm_ug_per_m3(2.5))
         values["P1"] = str(pm_values.pm_ug_per_m3(10))
     except ReadTimeoutError:
-        pms5003 = PMS5003()
+        pms5003.reset()
         pm_values = pms5003.read()
         values["P2"] = str(pm_values.pm_ug_per_m3(2.5))
         values["P1"] = str(pm_values.pm_ug_per_m3(10))
@@ -71,7 +71,7 @@ def read_values():
 
 # Get CPU temperature to use for compensation
 def get_cpu_temperature():
-    process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
+    process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
     output, _error = process.communicate()
     return float(output[output.index('=') + 1:output.rindex("'")])