Fix meter lifecycle and MQTT/HA integration bugs #1
@@ -258,6 +258,7 @@ static void mqttPublishDiscovery() {
|
||||
doc["name"] = name;
|
||||
doc["state_topic"] = stat;
|
||||
doc["command_topic"] = stat + "/set";
|
||||
doc["retain"] = true; // HA publishes commands retained so values survive restarts
|
||||
doc["availability_topic"] = String(mqttCfg.prefix) + "/status";
|
||||
doc["payload_available"] = MQTT_PAYLOAD_AVAILABLE;
|
||||
doc["payload_not_available"] = MQTT_PAYLOAD_NOT_AVAILABLE;
|
||||
|
||||
Reference in New Issue
Block a user