# Tests MQTT (manuel) ## Pre-requis - Broker MQTT accessible - Config YAML valide - Lancement de `pilot-v2` - Outil de test: `scripts/mqtt_send.py` (optionnel) ## Checklist - Availability: `pilot//availability` publie `online`. - Status: `pilot//status` publie un JSON valide, mis a jour sur le heartbeat. - Capabilities: `pilot//capabilities` publie un JSON valide. - Telemetrie: `pilot//state/cpu_usage` / `memory_*` / `ip_address`. - Power state: `pilot//state/power_state` (on/off/sleep/unknown/idle). - Commandes: - `pilot//cmd/shutdown/set` payload `OFF` -> action (dry_run si active). - `pilot//cmd/reboot/set` payload `OFF` -> action (dry_run si active). - `pilot//cmd/sleep/set` payload `OFF` -> action (dry_run si active). - `pilot//cmd/screen/set` payload `ON`/`OFF`. - Etats commandes: - `pilot//state/shutdown` -> `ON` ou `OFF`. - `pilot//state/reboot` -> `ON` ou `OFF`. - `pilot//state/sleep` -> `ON` ou `OFF`. - `pilot//state/screen` -> `ON` ou `OFF`. - HA discovery: entites visibles dans Home Assistant. ## Exemples d'envoi ``` python3 scripts/mqtt_send.py --host 127.0.0.1 --port 1883 --device monpc --action shutdown --value OFF python3 scripts/mqtt_send.py --host 127.0.0.1 --port 1883 --device monpc --action screen --value ON ``` ## Checklist pas a pas 1. Lancer le binaire (ou `scripts/run_pilot.sh`). 2. Verifier `availability`: - Topic: `pilot//availability` 3. Verifier `status`: - Topic: `pilot//status` 4. Verifier telemetrie: - Topic: `pilot//state/cpu_usage` 5. Envoyer une commande OFF: - `python3 scripts/mqtt_send.py --device --action shutdown --value OFF` 6. Verifier l'etat commande: - Topic: `pilot//state/shutdown` ## Notes - En mode `dry_run: true`, aucune action systeme n'est executee. - Verifier les logs pour confirmer la reception des commandes.