Pi-Hole stats on a Nextion display

what it is

stand-alone unit which makes an http request to the Pi-Hole API service to grab current statistics. ArduinoJSON is used to parse the JSON request to grab the specific values of each field.

whats used

  • ESP32
  • Nextion Display
  • Pi-Hole w/ API service enabled

code

Really wanted to re-use some code from a previous Pi-Hole project using an e-paper display and an ESP8266.

The Nextion display has it's own processor and memory, and images/text/functions are controlled via a simple serial interface at 9600 baud.

Let's say there is a textbox on the Nextion named 'status'. From the ESP, we can send a command over the serial interface to the Nextion display to change the text of that status textbox with the following command.

status.txt="hello world!"

Super simple! Can even upload images to the display, and use those images as the background for text boxes. This is the basic of this project.

Once this interface is created, simply create the code for the ESP32. Luckily the code from the previous projects are similar, we're just displaying the same API information in different ways.

The main thing I wanted was something to tell me if the service was enabled or not, as sometimes I do disable the Pi-Hole for work.

arduino-screenshot-on_off

An easy IF statement takes the parsed JSON data, and if 'status' = enabled, then a green indicator is shown with the text 'on'. Else, show a red indicator is shown.

3 Likes