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))
# 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("'")])