Giter Club home page Giter Club logo

piholed's Introduction

PiHOLED

PiHOLED is a basic Python script to display Raspberry Pi, Network & PiHole statistics on SH1106-based 1.3 inch (128x64) OLED display HATs, such as the Waveshare 1.3inch OLED Raspberry Pi HAT (can be modified to run on SSD1306-based HATs). Tested on a Raspberry Pi Zero W running DietPi but should theoretically work on any SBC + distro combination with a similar GPIO pinout.

Supports safe reboot by holding KEY1 for 3 seconds, safe shutdown by holding KEY2 for 3 seconds, rotating between brightness settngs with KEY3, and switching between System / Network monitoring using the joystick (left + right).

An aesthetically modified build of PiHOLED using the supErphoniX2 font.

Features:

Menus:

  • Hardware - Shows your CPU, RAM and storage.
  • Network - Shows your IP address, sent/received packets, and both total and blocked queries from PiHole.
  • Music - Shows your currently playing Spotify track! (WIP)
  • Games - Shows your current running emulator/core, system name & game name! (WIP)

Buttons:

KEY1 - Hold for 3 seconds to safely reboot. KEY2 - Hold for 3 seconds to shutdown. KEY3 - Press to cycle LCD brightness, hold mapping isn't set (yet) but you can modify the code to easily use it for whatever! Joystick - L/R switches between menu pages, U/D does nothing (yet?)

Requirements:

  • SPI + I2C enabled in DietPi/Raspbian (or similar distro)
  • python3
  • python3-pip
  • libopenjp2-7
  • psutil (pip)
  • requests (pip)
  • luma.oled (pip)
  • gpiozero (pip)

To install these on DietPi, install Python & RPi.GPIO via the DietPi Software installer & afterwards type "sudo apt install libopenjp2-7 && pip3 install psutil requests luma.oled" into your terminal.

For non-DietPi users, type "sudo apt install python3 python3-pip libopenjp2-7 && pip3 install psutil requests luma.oled gpiozero" instead, and modify the .service file to reflect your username.

How to install:

  • Download PiHOLED.py
  • Copy PiHOLED.py to your /home/dietpi directory
  • Edit PiHOLED.py & replace with your the contents of "WEBPASSWORD" in "/etc/pihole/setupVars.con".
  • Copy the PiHOLED.service script to /lib/systemd/system
  • Type "systemctl enable PiHOLED && systemctl start PiHOLED"

Configuration:

  • Rotate Screen: You can rotate the screen 180 degrees by finding "rotate=2" and changing it to "rotate=0" (or vice versa).

How to use with SSD1306-based HAT:

  • Open PiHOLED.py in Nano or a similar text editor
  • Change any instance of "sh1106" to "ssd1306"

TBD:

  • Choose better font for increased visual clarity. (supErphoniX2 works great at size 9 but it's not open-source).
  • Add an option to cycle between menu states automatically (for SH1106/SSD1306 LCDs without physical controls).
  • Further optimize CPU usage

Bugs:

  • CPU usage spikes by about 10% when screen refreshes, seemingly fine if you're just running PiHole but any headroom lost is still headroom lost. As far as I can tell from testing other similar Python scripts, this amount of CPU usage is about expected, but I would love to be shown otherwise.

Any and all feedback (optimizations, etc) is appreciated! Although feature requests will most likely be ignored as the scope of this project (basic PiHole + Pi statistics) has largely been covered already.

piholed's People

Contributors

faithvoid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.