Display PiHole statistics on ssd1306 128x64 I²C LCD
Inspired by this tutorial but tweaked, updated for 2022 libraries and without LED (and it works)
For Raspberry OS, make sure I²C is enabled within config
sudo raspi-config
Install required libraries (might work without all of them but just in case)
sudo apt install python3-gpiozero & pip install RPi.GPIO adafruit-circuitpython-ssd1306
Download PiHole_mon.py and font file
wget https://raw.githubusercontent.com/Rob2n/PiHole_Monitor/main/PiHole_mon.py ; wget https://raw.githubusercontent.com/Rob2n/PiHole_Monitor/main/VCR_OSD_MONO_1.001.ttf
Add a cron task by doing
crontab -e
and add the following line to the end
@reboot python3 /home/pi/PiHole_mon.py &
Every 30 seconds the screen refreshes the displayed data.
By pressing the button you can switch screens to display more info. The different screens are:
- Screen 1 (Main)
- Total blocked percentage
- Total blocked count
- Screen 2
- Total blocked count
- Total number of queries
- CPU temperature
- Screen 3
- CPU usage
- Memory in use/Total memory
- Disk space used/Total disk space