๐ Zero-touch provisioning for Raspberry Pi fleets - Configure WiFi, SSH, users, hardware peripherals, and manage devices through encrypted mesh networking
Project description
title: "MeshPi โ Zero-Touch Raspberry Pi Fleet Management" date: 2025-02-24 categories: [open-source, iot, raspberry-pi, python] tags: [meshpi, rpi, automation, llm, gpio, hardware-profiles, fleet-management] status: active version: "0.2.0" repo: https://github.com/pyfunc/meshpi license: Apache-2.0
MeshPi โ Zero-Touch Raspberry Pi Fleet Management
๐ Zero-touch provisioning for Raspberry Pi fleets
Configure WiFi, SSH, users, hardware peripherals, and manage devices โ all through encrypted mesh networking
Installation โข Quick Start โข Features โข Documentation
What is MeshPi?
MeshPi is an open-source Python package that eliminates the manual work of configuring Raspberry Pi devices from factory defaults. Whether you are deploying one device or an entire fleet, MeshPi handles WiFi credentials, SSH keys, user accounts, locale settings, hardware peripherals, and ongoing management โ all through a single CLI and an encrypted, zero-trust network protocol.
The project is built for embedded systems developers, IoT integrators, and hardware prototyping labs who regularly provision Raspberry Pi hardware and need a repeatable, secure, and automated workflow.
โจ Quick Start
# Install MeshPi
pip install meshpi
# On HOST machine (your PC or a dedicated RPi)
meshpi config # One-time configuration wizard
meshpi host # Start the host service
# On each CLIENT Raspberry Pi (fresh from factory)
meshpi scan # Auto-discover host, configure itself, and reboot
๐ฏ That's it! Your Raspberry Pi is now configured with WiFi, SSH access, user accounts, and ready for hardware automation.
๐๏ธ Architecture
MeshPi uses a hostโclient model with end-to-end RSA+AES-GCM encryption. No credentials ever travel in plaintext.
HOST (PC / RPi) CLIENT (fresh RPi)
โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ
meshpi config meshpi scan
โ ~/.meshpi/config.env โ mDNS discovery
meshpi host โ sends RSA public key
โ FastAPI + mDNS โ host encrypts config
โ WebSocket /ws/{id} โ client decrypts & applies
โ Dashboard /dashboard โ WiFi, SSH, user, locale
โ reboots
โ
meshpi daemon
โ persistent WebSocket
โ diagnostics push (60s)
โ executes remote commands
The host also exposes a real-time web dashboard at /dashboard and a full REST API with Swagger UI at /docs.
๐ Key Features
๐ Encrypted Zero-Touch Provisioning
Configuration is encrypted with AES-256-GCM. The session key is wrapped with the client's RSA-2048 public key. No shared secrets. No cleartext on the wire.
๐ก Real-Time Fleet Management
Once a device runs meshpi daemon, the host can push configuration changes, execute shell commands, apply hardware profiles, and trigger reboots โ all through the WebSocket channel. The REST endpoint POST /devices/{id}/push_config delivers updates instantly without re-provisioning.
๐ง 49+ Hardware Profiles
MeshPi ships with ready-to-apply profiles covering a wide range of peripherals:
| Category | Examples |
|---|---|
| display | OLED SSD1306 I2C, TFT ILI9341 SPI, e-Paper Waveshare, HDMI 1080p/4K, DSI Touchscreen |
| gpio | A4988/ARM69AK steppers, relay boards, PCA9685 servo controller, HC-SR04 distance sensor |
| sensor | BME280 (temp/humidity/pressure), DS18B20 (1-Wire), MPU-6050 (IMU), INA219 (power monitor) |
| camera | RPi Camera v2 & HQ, USB UVC, IR night vision |
| audio | HiFiBerry DAC+, I2S MEMS microphone |
| networking | CAN MCP2515, RS-485/Modbus, LoRa SX127x, nRF24L01 |
| hat | Sense HAT, PiSugar UPS, RTC DS3231, PoE+ |
| storage | USB boot, NFS, Samba |
Each profile installs apt packages, loads kernel modules, patches /boot/config.txt, and runs post-install commands โ all in one step:
meshpi hw apply oled_ssd1306_i2c sensor_bme280 gpio_stepper_arm69ak
๐ค LLM-Powered Management Agent
The optional meshpi[llm] extra installs LiteLLM, enabling a conversational agent that understands natural language fleet management commands:
You: co jest nie tak z rpi-kuchnia?
Agent: [fetches diagnostics] CPU temperature is 84ยฐC โ above safe threshold.
The throttled flag is set. Recommend improving airflow or adding a heatsink.
Services: wpa_supplicant is inactive โ WiFi may have dropped.
Suggest: restart wpa_supplicant and check SSID config.
You: zrestartuj usลugฤ WiFi na rpi-kuchnia
Agent: [pushes command] โ systemctl restart wpa_supplicant sent to rpi-kuchnia
Works with any LiteLLM-compatible provider: OpenAI, Anthropic, Ollama (local), Azure, Groq, and more.
๐พ USB Pendrive Offline Workflow
For air-gapped environments or devices without network access at first boot:
# On CLIENT โ seed USB with public key
meshpi pendrive seed
# On HOST โ encrypt config onto USB
meshpi pendrive export
# On CLIENT โ apply and reboot
meshpi pendrive apply
๐ Full Device Diagnostics
meshpi diag collects CPU load, memory, temperature, GPIO pin states, I2C device scan, SPI status, USB devices, WiFi signal, running services, failed systemd units, recent error logs, top processes, and power/voltage status. All metrics are also pushed to the host automatically by the daemon.
โ๏ธ Systemd Integration
Both the host service and client daemon can be installed as systemd services with a single flag:
meshpi host --install # installs meshpi-host.service
meshpi daemon --install # installs meshpi-daemon.service
๐ฆ Installation
pip install meshpi # core
pip install "meshpi[llm]" # + LiteLLM NLP agent
Python 3.9+ required. Works on any Linux system (host) and Raspberry Pi OS (client).
๐๏ธ Project Structure
meshpi/
โโโ meshpi/
โ โโโ cli.py # Click CLI (config/host/scan/daemon/hw/agent/pendrive/info)
โ โโโ config.py # Interactive wizard โ config.env
โ โโโ crypto.py # RSA-2048 + AES-256-GCM
โ โโโ host.py # FastAPI + WebSocket + mDNS + dashboard
โ โโโ client.py # mDNS scanner + WS daemon + config applier
โ โโโ applier.py # System configurator (user/WiFi/SSH/locale)
โ โโโ diagnostics.py # Full RPi system diagnostics collector
โ โโโ registry.py # Persistent device registry (JSON)
โ โโโ llm_agent.py # LiteLLM function-calling agent
โ โโโ systemd.py # Systemd service installer
โ โโโ pendrive.py # USB offline workflow
โ โโโ hardware/
โ โโโ profiles.py # 49 hardware profiles
โ โโโ applier.py # Profile applicator (apt/modprobe/config.txt)
โโโ tests/
โ โโโ test_meshpi.py # 59 tests (pytest) โ 100% passing
โโโ pyproject.toml
โโโ LICENSE # Apache 2.0
โโโ README.md
๐งช Test Coverage
The v0.2.0 release ships with 59 automated tests covering:
- Cryptographic primitives (RSA keygen, encrypt/decrypt roundtrip, cross-key isolation)
- Config file parsing and .env writing
- Device registry CRUD operations
- All 49 hardware profile definitions and filters
- System diagnostics collection
- All REST API endpoints (TestClient, no real network needed)
- CLI commands and option handling
pytest tests/ -v # 59 passed in ~8s
๐ณ Docker Support
MeshPi includes Docker support for testing and deployment:
# Build the image
docker build -t meshpi .
# Run host service
docker run -p 7422:7422 meshpi meshpi host --bind 0.0.0.0
# Or use docker-compose for full test environment
docker-compose up -d meshpi-host
docker-compose up meshpi-client # runs scan in dry-run mode
๐บ๏ธ Roadmap
The following features are planned for upcoming releases:
- v0.3 โ Web dashboard configuration editor (edit config.env from browser), device grouping and bulk commands
- v0.4 โ Prometheus/Grafana metrics export, webhook notifications on device events
- v0.5 โ OTA update management (apt upgrade via host), config versioning with rollback
- v1.0 โ Stable REST API, PyPI publish, Docker host image
๐ Links
- Repository: github.com/pyfunc/meshpi
- License: Apache 2.0
- Author: Softreck โ embedded systems, IoT automation, hardware prototyping
- Related projects: Portigen.com (portable power stations), Prototypowanie.pl (PCB prototyping)
๐ License
Apache License 2.0 - see LICENSE for details.
๐ค Author
Created by Tom Sapletta - tom@sapletta.com
License
Apache License 2.0 - see LICENSE for details.
Author
Created by Tom Sapletta - tom@sapletta.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file meshpi-0.1.11.tar.gz.
File metadata
- Download URL: meshpi-0.1.11.tar.gz
- Upload date:
- Size: 60.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d80a8dd39083e6e8f09327b43733718acbe200c8d63967dc1f7b83200a0e2f
|
|
| MD5 |
12ab0a42e08fdd52be954a0ecaf994ea
|
|
| BLAKE2b-256 |
bc0bfaabe564632c6920458c3b0d6ed28a75fdad4a442231dee2bae067efe1ca
|
File details
Details for the file meshpi-0.1.11-py3-none-any.whl.
File metadata
- Download URL: meshpi-0.1.11-py3-none-any.whl
- Upload date:
- Size: 56.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a7865b46830db617a52fdb4019981a18495e3b954dc6d5b9927e636de41fe3
|
|
| MD5 |
b2a847f24dd44d9804ffaf9919cf9903
|
|
| BLAKE2b-256 |
63513611772852bc632978d063927e08b5238d98290b483a019ed5b362c6e090
|