I had a little mouldy spot in my apartment. After removing it I was told to air more often to avoid the dewpoint. I was curious how often would be enough, but I had no data about humidity/dewpoint in my apartment. Commercially available humidity measuring devices supporting Prometheus do not seem to be available and I did not want to fall back behind the comfort of it. Hence I bought a LoLin NodeMCU V3 and a Bosch BME280 sensor and put this together. I paid 20€ for parts, but if you can wait for shipping from China you can reduce that sum to 10€.
It connects to WiFi and whenever one makes a TCP connection to it, it returns temperature, humidity, air pressure, and dewpoint in the Prometheus text format version 0.0.4.
Connect the sensor’s and the nodeMCU board’s pins:
You can use other SCL/SDA pins, but D5 and D6 are convenient because you can then solder the sensor to the board without using wires.
To run the exporter you need to have a NodeMCU firmware built with these modules:
Use Docker Image
You can use the provided Docker image to flash the nodemcu firmware:
Build Docker Image:
docker build -t mouldy .
Flash nodemcu firmware:
docker run --device=/dev/ttyUSB0 mouldy sh -c 'esptool.py write_flash -fm dio \ 0x00000 bin/nodemcu_float_*.bin'
Uploading code via Docker doesn't work yet. Help welcome!
Change the values of the vars ssid, wifipasswort and altitude (of the device’s position in meters) in location_example.lua and rename it to location.lua
Then upload all .lua-files to the nodeMCU and reboot it. I used nodemcu-uploader for that. nodemcu-uploader also allows you to connect to the terminal and a few basic control functions like reboot. The nodemcu_update.sh might be handy for that. It is very basic, but safes time.
- TLS (see nodeMCU module tls)
- export the scrape count