89 lines
2.0 KiB
Markdown
89 lines
2.0 KiB
Markdown
# pyLCDInfo
|
||
|
||
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
|
||
|
||
```bash
|
||
apt-get install i2c-tools pip python3-dev
|
||
pip3 install rpi_lcd netifaces
|
||
```
|
||
|
||
Search for the I2C LCD controller on bus X (0, 1, 2, 3, …) and note the device address:
|
||
|
||
```bash
|
||
i2cdetect -y X
|
||
```
|
||
|
||
## 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
|
||
After=network.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
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 end0 wlx000f007740cd wg0 /mnt/hdd/backups
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
```
|
||
|
||
```bash
|
||
systemctl daemon-reload
|
||
systemctl enable /lib/systemd/system/LCDinfo.service
|
||
systemctl start LCDinfo.service
|
||
```
|