Files
pilot/backup_v1/20251229_0205/prompt_method_redev.md
Gilles Soulier c5381b7112 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>
2025-12-30 06:23:00 +01:00

77 lines
3.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Methode de re-developpement / re-deploiement (V2)
## 1) Pre-requis
- Python 3.10+ (ou version a valider), paho-mqtt, psutil, optionnel pynvml.
- Repo structuree : `src/`, `configs/`, `docs/`, `scripts/`, `tests/`.
- Conventions : configuration centralisee (env/yaml), logs JSON, topics versionnes.
## 2) Liste des informations que lutilisateur doit completer
Section : A completer par lutilisateur
- OS cibles : [ ]
- Broker MQTT (host:port) : [ ]
- Auth/TLS (user/pass, CA, client cert) : [ ]
- Client_id et keepalive : [ ]
- Prefix topics (ex: pilot/v2) : [ ]
- Liste commandes a supporter : [ ]
- Politique de securite (allowlist, validation, ACL broker) : [ ]
- Packaging desire (exe Windows, systemd Linux, docker) : [ ]
- Integration Home Assistant autodiscovery : [oui/non] + details : [ ]
- Availability / birth / will : [ ]
- Frequence telemetrie (par capteur) : [ ]
- Metriques a exposer (CPU, RAM, GPU, IP, batterie, etc.) : [ ]
- Politique de logs (format, rotation) : [ ]
## 3) Plan iteratif (prompts)
Prompt 1 :
"Genere larchitecture cible + conventions. Cree `docs/architecture.md` et `docs/topics.md`. Liste modules, flux, schemas de payload, et conventions de config."
- Fichiers : `docs/architecture.md`, `docs/topics.md`
- Checklist : schema topics, flux MQTT, decisions securite
- Sortie attendue : docs completes
Prompt 2 :
"Implemente le noyau MQTT + config + logs. Cree `src/app.py`, `src/config.py`, `src/logging.py`. Ajoute `configs/example.env`."
- Fichiers : `src/app.py`, `src/config.py`, `src/logging.py`, `configs/example.env`
- Checklist : connexion MQTT, LWT, logs JSON, chargement config
- Sortie attendue : demarrage local + doc config
Prompt 3 :
"Implemente le moteur de commandes avec allowlist. Cree `src/commands/` et `docs/commands.md`."
- Fichiers : `src/commands/__init__.py`, `src/commands/linux.py`, `docs/commands.md`
- Checklist : validation payload, allowlist, dry-run option
- Sortie attendue : commandes securisees + doc
Prompt 4 :
"Ajoute availability/LWT + heartbeat + etats. Etends `src/app.py` et `docs/topics.md`."
- Fichiers : `src/app.py`, `docs/topics.md`
- Checklist : LWT, availability topic, cadence heartbeat
- Sortie attendue : etats en retained
Prompt 5 :
"Ajoute autodiscovery Home Assistant (si demande). Cree `src/hass.py` et `docs/hass.md`."
- Fichiers : `src/hass.py`, `docs/hass.md`
- Checklist : discovery payloads, device_info, tests de base
- Sortie attendue : entites visibles dans HA
Prompt 6 :
"Packaging Windows (service/tache). Cree `docs/deploy_windows.md` et scripts."
- Fichiers : `docs/deploy_windows.md`, `scripts/install_windows.ps1`
- Checklist : lancement automatique, permissions, rollback
- Sortie attendue : procedure Windows claire
Prompt 7 :
"Packaging Linux (systemd). Cree `docs/deploy_linux.md`, `scripts/install_linux.sh`, `packaging/mqtt_pilot.service`."
- Fichiers : `docs/deploy_linux.md`, `scripts/install_linux.sh`, `packaging/mqtt_pilot.service`
- Checklist : user/service, restart policy, logs journald
- Sortie attendue : service systemd fonctionnel
Prompt 8 :
"Tests + harness MQTT + doc + exemples. Cree `tests/`, `scripts/mqtt_harness.py`, `docs/examples.md`."
- Fichiers : `tests/test_topics.py`, `scripts/mqtt_harness.py`, `docs/examples.md`
- Checklist : tests unitaires, exemples payload, validation topics
- Sortie attendue : test suite + exemples
## 4) Procedure de re-deploiement
- Strategie : nouveau dossier (V2) + migration progressive.
- Migration config : convertir valeurs hardcodees vers env/yaml.
- Compatibilite topics : versionner `pilot/v2` et garder mapping legacy.
- Rollback : conserver ancien service et bascule via systemd.