geerlingguy / airgradient-prometheus

AirGradient Prometheus exporter.
MIT License
174 stars 59 forks source link

[Improvement Suggestion] Temperature sensor offset management #19

Closed Thelvaen closed 2 years ago

Thelvaen commented 2 years ago

Hello,

SHT30/SHT31 as well as BME280 & other sensors of that kind typically have an offset of +/- 1°C, added to that the sensor enclosure & the proximity of other electronic component, the offset can easily rack up to a couple of °C.

Hence, in order to avoid recompiling and be able to simply tweak the offset to get a value as close to the real temperature as possible, I added some logic to the code available on my BME280 fork to store the Temperature Offset in the EEPROM, setup a route to get/set the value, and each time the temperature is fetched (on screen display or scrapped by Prometheus) the offset is applied.

Feel free to add my code to yours, or to ask me to do a specific PR, if you want it without the BME280 extension.

Benargee commented 2 years ago

Not sure if this would satisfy your needs, but in Grafana you can add an offset of queried data. atmp{job="airgradient-bedroom"} -1 Not sure if you can add an offset for data being scraped by Prometheus.

Thelvaen commented 2 years ago

I mean, I implemented the offset on the sensor already (see my fork), so the value displayed by the sensor is correct as well.

Benargee commented 2 years ago

Understood, but this is a suggestion with much less complexity for those that it might suit.

stale[bot] commented 2 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale[bot] commented 2 years ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.