You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This uses the Pimoroni Enviro+ HAT to send environmental monitoring stats to Prometheus.
What Works, and What Doesn't
Usual disclaimer: I am not a programmer, so this may all be suuuuuper messy.
I did not include support for the particulate matter sensor, since I don't have one of those to test with.
The other sensors do work. However, I've been unable to find any information (so far) as to what exactly the proximity sensor is measuring, or what the noise sensor is measuring. I assume noise level in db, but I can't find any documentation. Same for amplitude. The examples provided by Pimoroni are inconsistent, too.
This also doesn't use the screen on the hat at all.
Relevant metrics are exposed using the enviroplus_ prefix. It does work on the regular Enviro (which does not have the gas sensors), despite the prefix having plus in it.
Raspberry PI. Any Raspberry PI -- this works very well on a Pi Zero.
A GPIO extention cable, or some other way to have the HAT not sit directly on the PI. The PI's CPU temperature will affect readings.
Prometheus server (obviously).
Installation
This assumes you'll be using the default 'pi' user.
Set up Raspberry PI with the latest 'lite' version of Raspberry PI OS.
Follow the instructions to installing the Pimoroni libraries here.
Install the Prometheus client python library using python3 -m pip install prometheus-client (you might need to sudo apt-get install python3-pip first).
Download prometheus_enviroplus_exporter.py and put it in /usr/local/bin/. Make sure it is executable.
Test
Run the program manually using /usr/local/bin/prometheus_enviroplus_exporter.py. If you don't see any errors, congratulations! It's probably working!
By default, the exporter listens on port 9892, so curl localhost:9892/metrics should show the metrics.
systemd
To get the thing to start automatically, download prometheus_enviroplus_exporter.service and place it in /etc/systemd/system/. Then run sudo systemctl enable prometheus_enviroplus_exporter.service.
Prometheus Configuration
This is dependent on your own setup, but I create a JSON file in wherever Prometheus' base_node data is (usually /etc/prometheus_data/base_node) called enviro-<location>.json, and it looks something like this: