overthesun / simoc-sam

Live backend for SAM at Biosphere 2
2 stars 1 forks source link

Add `sensors.toml` and refactor the code to use it #76

Closed ezio-melotti closed 7 months ago

ezio-melotti commented 8 months ago

This PR adds a new sensors.toml file that includes data about sensors, e.g.:

[scd30]
name = "SCD30"
description = "NDIR CO2, Temperature, and Humidity Sensor"
module = "simoc_sam.sensors.scd30"
i2c_address = 0x61

    [scd30.data.CO2]
    unit = "ppm"
    label = "CO2 Concentration"

    [scd30.data.temperature]
    unit = "°C"
    label = "Temperature"

    [scd30.data.humidity]
    unit = "%RH"
    label = "Humidity"

It also includes a few utilities to access these info easily, and some code-refactoring to use them instead of hardcoded values.