mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
make unknown - #2124
This commit is contained in:
12
src/mqtt.cpp
12
src/mqtt.cpp
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user