# ha-diag-agent environment variables
# Copy to /opt/homelab/config/ha-diag-agent/.env on the target node

# Home Assistant connection (required)
# piha:          HA_URL=http://localhost:8123
# chelsty-infra: HA_URL=http://100.70.180.90:8123  (chelsty-ha Tailscale IP)
HA_URL=http://localhost:8123
# Obtain from HA UI: Settings → People → <diag_agent user> → Long-Lived Access Tokens
HA_TOKEN=your-long-lived-token-here
HA_TIMEOUT=10.0

# Node identity  (must match the node's canonical name in the homelab inventory)
NODE_NAME=piha
LOCATION_TAG=ken

# Check intervals (seconds)
CHECK_INTERVAL=60         # heartbeat check
CHECK_INTERVAL_UNAVAILABLE=3600  # entity availability check (1h)

# Unavailable entities thresholds
UNAVAILABLE_THRESHOLD_HOURS=24   # alert after N hours unavailable
INTEGRATION_FAILURE_THRESHOLD_PCT=0.5  # fraction of integration entities
INTEGRATION_FAILURE_MIN_ENTITIES=3     # minimum count for integration event
ALERT_COOLDOWN_HOURS=6           # suppress re-alert within N hours

# API server
PORT=8087

# Logging: debug, info, warning, error
LOG_LEVEL=info
