ha_discovery: publish state/availability under home_automation prefix
Follow the standard MQTT Discovery split: discovery config stays under the HA discovery prefix (homeassistant/.../config, required), but the actual state and availability are published under our own prefix (default home_automation/). The config payload's state_topic/availability fields point at the new prefix so HA reads state from there. - new config ha_state_topic_prefix (default home_automation). - build_discovery_payload + all publish_* split discovery_prefix (config topic) from state_prefix (state/availability). energy-cost still omits availability; modbus availability structure unchanged. Tests updated.
This commit is contained in:
@@ -43,8 +43,11 @@ MQTT_TLS_ENABLED=false
|
||||
|
||||
# Optional: Home Assistant MQTT Discovery.
|
||||
# Requires MQTT_ENABLED=true and a running MQTT broker.
|
||||
# HA_DISCOVERY_PREFIX is the config topic prefix (must be "homeassistant" for HA auto-discovery).
|
||||
# HA_STATE_TOPIC_PREFIX is the prefix for state/availability topics (separate from discovery).
|
||||
HA_DISCOVERY_ENABLED=false
|
||||
HA_DISCOVERY_PREFIX=homeassistant
|
||||
HA_STATE_TOPIC_PREFIX=home_automation
|
||||
|
||||
# Optional: DSMR smart-meter ingest via MQTT (M6; default off — opt-in).
|
||||
# Set DSMR_INGEST_ENABLED=true to subscribe to the DSMR MQTT topic and
|
||||
|
||||
Reference in New Issue
Block a user