Remove stat_cla property from HA discovery message if null

This commit is contained in:
Gunnar Skjold 2022-03-18 19:19:37 +01:00
parent 40016f314e
commit 48bd352619
2 changed files with 3 additions and 3 deletions

View File

@ -227,7 +227,8 @@ bool HomeAssistantMqttHandler::publishSystem(HwTools* hw) {
VERSION,
haManuf.c_str(),
haUrl.c_str(),
strlen_P(HA_STACL[i]) > 0 ? (char *) FPSTR(HA_STACL[i]) : "null"
strlen_P(HA_STACL[i]) > 0 ? ", \"stat_cla\" :" : "",
strlen_P(HA_STACL[i]) > 0 ? (char *) FPSTR(HA_STACL[i]) : ""
);
mqtt->publish(haTopic + haUID + "_" + FPSTR(HA_PARAMS[i]) + "/config", json, true, 0);
}

View File

@ -13,6 +13,5 @@
"sw" : "%s",
"mf" : "%s",
"cu" : "%s"
},
"stat_cla" : %s
}%s %s
}