make unknown - #2124

This commit is contained in:
proddy
2024-10-23 17:49:16 +02:00
parent d248d5cc21
commit 0d43703f16

View File

@@ -1416,11 +1416,13 @@ void Mqtt::add_ha_sections_to_doc(const char * name,
const char * tpl_draft = "{{'online' if %s else 'offline'}}"; const char * tpl_draft = "{{'online' if %s else 'offline'}}";
// condition 1 // condition 1
avty_json.clear(); if (cond1 != nullptr) {
avty_json["t"] = state; avty_json.clear();
snprintf(tpl, sizeof(tpl), tpl_draft, cond1 == nullptr ? "value is defined" : cond1); avty_json["t"] = state;
avty_json["val_tpl"] = tpl; snprintf(tpl, sizeof(tpl), tpl_draft, cond1);
avty.add(avty_json); // returns 0 if no mem avty_json["val_tpl"] = tpl;
avty.add(avty_json); // returns 0 if no mem
}
// condition 2 // condition 2
if (cond2 != nullptr) { if (cond2 != nullptr) {