From ac58d23a088001c80bd9e43c6c9cf22a4e70b9cf Mon Sep 17 00:00:00 2001 From: iranl Date: Tue, 6 Feb 2024 22:13:21 +0100 Subject: [PATCH] Additional fixes --- Network.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Network.cpp b/Network.cpp index 0581b3c8..afe1973e 100644 --- a/Network.cpp +++ b/Network.cpp @@ -951,7 +951,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n "Unlatch", name, baseTopic, - _lockPath + mqtt_topic_mqtt_connection_state, + "", deviceType, "", "", @@ -974,7 +974,7 @@ void Network::publishHASSConfigAdditionalButtons(char *deviceType, const char *b "Lock 'n' Go", name, baseTopic, - _lockPath + mqtt_topic_mqtt_connection_state, + "", deviceType, "", "", @@ -991,7 +991,7 @@ void Network::publishHASSConfigAdditionalButtons(char *deviceType, const char *b "Lock 'n' Go with unlatch", name, baseTopic, - _lockPath + mqtt_topic_mqtt_connection_state, + "", deviceType, "", "", @@ -1245,8 +1245,12 @@ void Network::publishHassTopic(const String& mqttDeviceType, { json["dev_cla"] = deviceClass; } - json["stat_t"] = stateTopic; - + + if(stateTopic != "") + { + json["stat_t"] = stateTopic; + } + if(stateClass != "") { json["stat_cla"] = stateClass; @@ -1259,6 +1263,8 @@ void Network::publishHassTopic(const String& mqttDeviceType, { json["cmd_t"] = commandTopic; } + + json["avty"]["t"] = _lockPath + mqtt_topic_mqtt_connection_state; for(const auto& entry : additionalEntries) {