Live temperature readings from your room, as Discord Rich Presence!
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fugi 1170efde05
Add prometheus metrics endpoint
1 year ago
discord-rpc update package.json 2 years ago
esp-server Add prometheus metrics endpoint 1 year ago
.gitignore basic esp-server 2 years ago
LICENSE Create LICENSE 2 years ago Add prometheus metrics endpoint 1 year ago


ESP Board / API

This was made for a NodeMCU ESP8266 development board and a DTH22 sensor. There are guides available on the internet on how to wire this up, depending on your model.
The code could also be easily adapted to utilize a DTH11 or with a little effort even any other sensor.

Install the libraries 'Adafruit Unified Sensor' and 'DHT sensor library'.

Before flashing you need to set the SSID and Password of your WiFi in arduino_secrets.h (as in the example file) and adjust the static IP settings at the top of esp-server.ino for your network.

There are currently four API endpoints:

  • /weather: returns temperature and humidity as application/json
  • /temperature: returns raw temperature reading in celsius as text/plain
  • /humidity: returns raw humidity reading in percent as text/plain
  • /metrics: prometheus metrics

Discord RPC

First edit config.json (copy the example) and fill in your application id from discord as well as your apiBaseURL (the local ip of your ESP8266).
You can also configure the updateInterval (in seconds) and the RPC labels/button.

Install dependencies and run it:

yarn start


This code is licensed under the GPL v3.0 or later.
Feel free to fork and PR if you want to improve it :)


esp-server.ino is based on the Arduino example ESP8266WebServer/HelloServer.
The Discord RPC is based on simple-discord-rpc by Jxyme.