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

44 lines
859 B
YAML

# Codex created 2025-12-29_0224
device:
name: $hostname
identifiers: ["$hostname"]
mqtt:
host: "10.0.0.3"
port: 1883
username: ""
password: ""
base_topic: "pilot"
discovery_prefix: "homeassistant"
client_id: "$hostname"
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