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:
34
scripts/mqtt_send.py
Normal file
34
scripts/mqtt_send.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Script simple pour publier des commandes MQTT (tests manuels).
|
||||
import argparse
|
||||
import time
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Envoi de commandes MQTT pour pilot-v2")
|
||||
parser.add_argument("--host", default="127.0.0.1")
|
||||
parser.add_argument("--port", type=int, default=1883)
|
||||
parser.add_argument("--device", required=True)
|
||||
parser.add_argument("--action", required=True, choices=["shutdown", "reboot", "sleep", "screen"])
|
||||
parser.add_argument("--value", required=True, choices=["ON", "OFF"])
|
||||
parser.add_argument("--username", default="")
|
||||
parser.add_argument("--password", default="")
|
||||
args = parser.parse_args()
|
||||
|
||||
topic = f"pilot/{args.device}/cmd/{args.action}/set"
|
||||
|
||||
client = mqtt.Client()
|
||||
if args.username or args.password:
|
||||
client.username_pw_set(args.username, args.password)
|
||||
|
||||
client.connect(args.host, args.port, 60)
|
||||
client.loop_start()
|
||||
client.publish(topic, args.value, qos=0, retain=False)
|
||||
time.sleep(0.5)
|
||||
client.loop_stop()
|
||||
client.disconnect()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user