Files
pilot/config/config.example.yaml
Gilles Soulier 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

52 lines
1.3 KiB
YAML

# Codex created 2025-12-29_0224
# Configuration example for Pilot v2
# Special variables:
# $hostname - Will be replaced by the system hostname at runtime
device:
name: $hostname # Use $hostname for automatic hostname, or a custom name like "my-pc"
identifiers: ["$hostname"]
manufacturer: "Pilot" # Manufacturer name shown in Home Assistant
model: "PC Agent" # Model name (e.g., "Laptop", "Desktop", "Server")
sw_version: "2.0.0" # Software version
suggested_area: "Bureau" # Suggested area in Home Assistant (optional)
mqtt:
host: "127.0.0.1"
port: 1883
username: ""
password: ""
base_topic: "pilot"
discovery_prefix: "homeassistant"
client_id: "$hostname" # MQTT client ID - use $hostname or a custom ID
keepalive_s: 60
qos: 0
retain_states: true
features:
telemetry:
enabled: true
interval_s: 10
commands:
enabled: true
cooldown_s: 5
dry_run: true
allowlist: ["shutdown", "reboot", "sleep", "screen"]
power_backend:
linux: "linux_logind_polkit" # or linux_sudoers
windows: "windows_service"
screen_backend:
linux: "gnome_busctl" # or x11_xset
windows: "winapi_session" # or external_tool
publish:
heartbeat_s: 30
availability: true
paths:
linux_config: "/etc/pilot/config.yaml"
windows_config: "C:\\ProgramData\\Pilot\\config.yaml"
# Codex modified 2025-12-29_0224