Skip to content

Instantly share code, notes, and snippets.

Avatar

So build it sobuildit

  • So build it
  • Southampton, UK
View GitHub Profile
View GPIOSetup.py
import RPi.GPIO as GPIO
# GPIO setup for front panel button
panelButton = 14
GPIO.setmode(GPIO.BCM)
GPIO.setup(panelButton, GPIO.IN, pull_up_down=GPIO.PUD_UP)
View SSD1306Setup.py
from board import SCL, SDA
import busio
from PIL import Image, ImageDraw
import adafruit_ssd1306
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
disp = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
View pythonDataGathering.py
import psutil
from vcgencmd import Vcgencmd
vcgm = Vcgencmd()
# Network stuff from psutil
net_if_addrs = psutil.net_if_addrs()['eth0'][0]
IP = net_if_addrs.address
netmask = net_if_addrs.netmask
View pythonDataGathering2.py
# one-time information grabs
cmd = "dpkg -l | awk '/openmediavault /{ print $3;} '"
omvpkg = subprocess.check_output(cmd, shell=True).decode("utf-8")
print("OMV Version: ", omvpkg)
# date / time
cmd = "date +\"%H:%M %d/%m/%Y\""
date = subprocess.check_output(cmd, shell=True).decode("utf-8")
print("Date: ", date)
View frontpanel.service
[Unit]
Description=DaveNAS front panel service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/pi/display_stat.py
[Install]
WantedBy=multi-user.target