7 Commits

Author SHA1 Message Date
6c4c6ee866 correction mdi icon 2026-01-10 20:39:20 +01:00
91bfcff1fe corrige temperature 2026-01-10 20:24:11 +01:00
ff3fc65eef Remove 'type' field from discovery payload per HA spec
The type field is not required in the discovery payload JSON.
The entity type is determined by the discovery topic itself:
- homeassistant/sensor/.../config indicates a sensor
- homeassistant/switch/.../config indicates a switch

This aligns with the official Home Assistant MQTT discovery documentation.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 08:22:05 +01:00
60b622c6be Align MQTT discovery with v1 format and HA specification
This commit fixes the MQTT discovery payload structure to match the working
v1 implementation and comply with Home Assistant's MQTT discovery specification.

Key changes:
- Add "type" field to discovery payload (sensor/switch)
- Update discovery topic format: homeassistant/{component}/{node_id}/{entity_name}/config
- Fix entity naming: {metric}_{device} instead of descriptive names
- Separate state topics for sensors vs switches:
  * Sensors: pilot/{device}/{metric} (no /state suffix)
  * Switches: pilot/{device}/{metric}/state (with /state suffix)
- Add per-entity availability topics: pilot/{device}/{metric}/available
- Add publish_switch_state() function for proper switch state publishing

Discovery topic examples:
- homeassistant/sensor/asus/cpu_usage_asus/config
- homeassistant/switch/asus/shutdown_asus/config

State topic examples:
- pilot/asus/cpu_usage (sensor)
- pilot/asus/shutdown/state (switch)

This matches the Dell 5520 v1 configuration that works correctly.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 08:14:44 +01:00
df871ddf6e Fix Home Assistant MQTT discovery compliance
This commit fixes several issues with the MQTT discovery payload to ensure
full compliance with Home Assistant's MQTT discovery specification and match
the working configuration from the v1 implementation.

Changes:
- Add payload_available ("online") and payload_not_available ("offline") fields
  to EntityConfig struct for proper availability handling in HA
- Make device_info parameters (manufacturer, model, sw_version, suggested_area)
  configurable via config.yaml instead of hardcoded values
- Remove incorrect device_class "power" from cpu_usage sensor (power is for Watts, not %)
- Update config.example.yaml with documented device_info fields

The discovery payload now correctly includes all required fields for HA to
properly register and display the device with its sensors and switches.

Tested on physical PC (asus) with MQTT broker at 10.0.0.3:1883.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 07:39:24 +01:00
1640754df8 Add $hostname variable substitution in config
This commit adds support for automatic hostname substitution in configuration files.
Users can now use $hostname in device.name, device.identifiers, and mqtt.client_id
to automatically use the system's hostname.

Changes:
- Add hostname crate dependency (v0.4)
- Implement expand_variables() to replace $hostname with actual hostname
- Add get_hostname() helper function
- Update config.example.yaml to demonstrate $hostname usage
- Add test for hostname substitution
- Update config.yaml to use $hostname by default
- Add test_command.sh script for testing MQTT commands

This makes deployment easier across multiple machines without manual config changes.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 06:52:41 +01:00
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