It's Arduino code for NodeMCU ESP8266 client. We have two branches:
- main : MQTT
- prom : Prometheus metrics
-
Create your env file from
env.cpp.example
:#include <Arduino.h> #include "env.h" String wifi_ssid = "your wifi ssid"; String wifi_password = "your wifi password"; const char* mqtt_server = "your mqtt server address ( without port number )";
-
Set your sensor's id in
NodeMCU-Sensor.ino
:String sensor_id = "4";
-
Upload project to your device
The temperature and humidity values will read every 30 seconds ( You can change the interval ) and publish to MQTT server if there are significant changes in them.