add logging for measurements

This commit is contained in:
Denis-Cosmin Nutiu 2024-02-08 23:13:10 +02:00
parent 12635de567
commit 22abd2258a
2 changed files with 6 additions and 0 deletions

View file

@ -73,6 +73,10 @@ class Bme680Sensor(Accessory):
if self.sensor.data.heat_stable: if self.sensor.data.heat_stable:
self._gas_resistance_metric.set(self.sensor.data.gas_resistance) 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) @Accessory.run_at_interval(120)
def run(self): def run(self):
""" """

View file

@ -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_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_2.set(data.pm_ug_per_m3(2.5))
self._pms5003_pm_ug_per_m3_10.set(data.pm_ug_per_m3(10)) 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: except IOError as e:
# This happens from time to time, best we stop and let systemd restart us. # This happens from time to time, best we stop and let systemd restart us.
logging.critical("Failed to read data from serial.") logging.critical("Failed to read data from serial.")