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:
@@ -57,6 +57,9 @@ class Settings(BaseSettings):
|
||||
# Home Assistant MQTT Discovery (T08 wires into CONFIG_FIELDS/UI; T11 does publishing).
|
||||
ha_discovery_enabled: bool = False
|
||||
ha_discovery_prefix: str = "homeassistant"
|
||||
# State/availability topics use a separate prefix so they live outside the HA discovery
|
||||
# namespace. HA still receives state via the state_topic declared in the discovery config.
|
||||
ha_state_topic_prefix: str = "home_automation"
|
||||
|
||||
# DSMR smart-meter ingest via MQTT (M6; default off — opt-in).
|
||||
# Subscribe to dsmr_mqtt_topic when dsmr_ingest_enabled=True.
|
||||
|
||||
Reference in New Issue
Block a user