From 22abd2258af9b16b4d3291ab70d98c04cf759ebd Mon Sep 17 00:00:00 2001 From: dnutiu Date: Thu, 8 Feb 2024 23:13:10 +0200 Subject: [PATCH] add logging for measurements --- app/sensors/bme.py | 4 ++++ app/sensors/pms.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/sensors/bme.py b/app/sensors/bme.py index 16de527..40fc425 100644 --- a/app/sensors/bme.py +++ b/app/sensors/bme.py @@ -73,6 +73,10 @@ class Bme680Sensor(Accessory): if self.sensor.data.heat_stable: self._gas_resistance_metric.set(self.sensor.data.gas_resistance) + logging.info( + f"T: {self.sensor.data.temperature}; H: {self.sensor.data.humidity}: P: {self.sensor.data.pressure}") + logging.info(f"G: {self.sensor.data.gas_resistance}") + @Accessory.run_at_interval(120) def run(self): """ diff --git a/app/sensors/pms.py b/app/sensors/pms.py index a6d648e..e65317c 100644 --- a/app/sensors/pms.py +++ b/app/sensors/pms.py @@ -45,6 +45,8 @@ class Pms5003Sensor(Accessory): self._pms5003_pm_ug_per_m3_1.set(data.pm_ug_per_m3(1.0)) self._pms5003_pm_ug_per_m3_2.set(data.pm_ug_per_m3(2.5)) self._pms5003_pm_ug_per_m3_10.set(data.pm_ug_per_m3(10)) + + logging.info(f"PM1.0 {data.pm_ug_per_m3(1.0)} PM2.5 {data.pm_ug_per_m3(2.5)} PM10 {data.pm_ug_per_m3(10)}") except IOError as e: # This happens from time to time, best we stop and let systemd restart us. logging.critical("Failed to read data from serial.")