Pilot v2: Core implementation + battery telemetry

Major updates:
- Complete Rust rewrite (pilot-v2/) with working MQTT client
- Fixed MQTT event loop deadlock (background task pattern)
- Battery telemetry for Linux (auto-detected via /sys/class/power_supply)
- Home Assistant auto-discovery for all sensors and switches
- Comprehensive documentation (AVANCEMENT.md, CLAUDE.md, roadmap)
- Docker test environment with Mosquitto broker
- Helper scripts for development and testing

Features working:
 MQTT connectivity with LWT
 YAML configuration with validation
 Telemetry: CPU, memory, IP, battery (Linux)
 Commands: shutdown, reboot, sleep, screen (dry-run tested)
 HA discovery and integration
 Allowlist and cooldown protection

Ready for testing on real hardware.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Gilles Soulier
2025-12-30 06:23:00 +01:00
parent b7e67c6501
commit c5381b7112
4453 changed files with 78647 additions and 0 deletions

View File

@@ -93,3 +93,78 @@ lancer l'installation du service:
```
sudo ./install.sh
```
## PILOT v2 (Rust) ✅ FUNCTIONAL
**Status**: Core implementation complete and tested. Ready for feature development.
### Quick Start
```bash
# Start MQTT broker (Docker required)
./scripts/start_mqtt_broker.sh
# Run pilot v2
./scripts/run_pilot.sh
# In another terminal, monitor messages
./scripts/monitor_mqtt.sh
# Send a test command
docker exec pilot-mosquitto mosquitto_pub -t "pilot/pilot-device/cmd/screen/set" -m "OFF"
```
### Documentation
- **[Implementation Status](docs/implementation_status.md)** - What's implemented and what's missing
- **[Development Roadmap](docs/development_roadmap.md)** - Planned features and priorities
- **[Testing Results](docs/testing_results.md)** - End-to-end test validation
- **[Architecture](docs/architecture_v2.md)** - MQTT contract and module structure
- **[Deployment Guide](docs/deploiement.md)** - Systemd service setup
- **[Usage Guide](docs/utilisation.md)** - How to use pilot v2
### Configuration
Example config: `config/config.example.yaml`
Key settings:
- MQTT broker connection
- Telemetry interval (default: 10s)
- Commands allowlist
- Dry-run mode (safety during development)
- Platform backends (power and screen control)
### Development
```bash
# Run tests
cd pilot-v2 && cargo test
# Build release
cd pilot-v2 && cargo build --release
# Check code
cd pilot-v2 && cargo check
```
### Features (v2)
**Working**:
- ✅ MQTT connectivity with LWT
- ✅ YAML configuration
- ✅ Telemetry (CPU, memory, IP, battery*)
- ✅ Power commands (shutdown, reboot, sleep)
- ✅ Screen control (on/off)
- ✅ Home Assistant auto-discovery
- ✅ Command allowlist and cooldown
- ✅ Dry-run mode for safe testing
_* Battery telemetry: Linux only, auto-detected_
**Planned** (see roadmap):
- CPU temperature
- Battery support for Windows
- GPU telemetry
- Windows backend implementation
- TLS/SSL support
- Integration tests