stabilty and multiple interfaces

This commit is contained in:
2026-08-21 14:38:52 +02:00
parent b67ed823c2
commit 37f5f135da
2 changed files with 326 additions and 89 deletions
+61 -10
View File
@@ -1,20 +1,69 @@
# pyLCDInfo
display current linux/network info on a 16x2 LCD via I2C
Display current Linux/network info on a 16×2 LCD via I2C.
## Features
- Shows IPv4 and IPv6 for **multiple** network interfaces
- Displays `<interface> not connected` gracefully when an interface is unavailable — no crashes
- WireGuard VPN state detection with animated waiting screen
- Startup sequence showing kernel version, OS version, MAC addresses, and WireGuard endpoint
- Backlight turns off automatically once VPN is connected
## Startup screens (2 s each)
| Screen | Content |
|---|---|
| Welcome | "Offsite Backup" banner |
| Kernel | Running kernel version (`uname -r`) |
| OS | Pretty name from `/etc/os-release` |
| MAC \<iface\> | MAC address per interface (repeated for each) |
| WG Endpoint | Resolved hostname or IP of the WireGuard peer |
## Install
`apt-get install i2c-tools pip python3-dev`
```bash
apt-get install i2c-tools pip python3-dev
pip3 install rpi_lcd netifaces
```
`pip3 install rpi_lcd`
Search for the I2C LCD controller on bus X (0, 1, 2, 3, …) and note the device address:
search I2C LCD Controller on Bus X (0, 1, 2, 3, ...) and note address of device
`i2cdetect -y X`
```bash
i2cdetect -y X
```
`nano /lib/systemd/system/LCDinfo.service`
## Usage
```
python3 pyLCDinfo.py <iface1> [iface2 ...] <wireguard_iface> <disk_path>
```
**Arguments (in order):**
| Position | Description |
|---|---|
| `iface1 [iface2 ...]` | One or more local network interfaces (e.g. `eth0 eth1`) |
| `wireguard_iface` | WireGuard interface name (e.g. `wg0`) |
| `disk_path` | Path to monitor for free disk space (e.g. `/mnt/hdd/backups`) |
**Examples:**
```bash
# Single interface
python3 pyLCDinfo.py eth0 wg0 /mnt/hdd/backups
# Multiple interfaces
python3 pyLCDinfo.py eth0 eth1 wlan0 wg0 /mnt/hdd/backups
```
## systemd service
```bash
nano /lib/systemd/system/LCDinfo.service
```
```ini
[Unit]
Description=LCD info
After=syslog.target
@@ -26,12 +75,14 @@ User=root
Group=root
Restart=on-failure
RestartSec=5s
ExecStart=sudo /usr/bin/nice -n 19 sudo -u root /usr/bin/python3 /root/pyLCDinfo.py eth0 wg0 /mnt/hdd/backups
ExecStart=sudo /usr/bin/nice -n 19 sudo -u root /usr/bin/python3 /root/pyLCDinfo.py end0 wlx000f007740cd wg0 /mnt/hdd/backups
[Install]
WantedBy=multi-user.target
```
`systemctl daemon-reload`
`systemctl enable /lib/systemd/system/LCDinfo.service`
```bash
systemctl daemon-reload
systemctl enable /lib/systemd/system/LCDinfo.service
systemctl start LCDinfo.service
```