mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix issue with HA, removing availability check for online status as it may not have been published in time
This commit is contained in:
12
src/mqtt.cpp
12
src/mqtt.cpp
@@ -1312,13 +1312,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'}}";
|
||||||
|
|
||||||
// EMS-ESP status check
|
|
||||||
char tpl[150];
|
char tpl[150];
|
||||||
snprintf(tpl, sizeof(tpl), "%s/status", Mqtt::base().c_str());
|
// EMS-ESP status check
|
||||||
avty_json["t"] = tpl;
|
// snprintf(tpl, sizeof(tpl), "%s/status", Mqtt::base().c_str());
|
||||||
snprintf(tpl, sizeof(tpl), tpl_draft, "value == 'online'");
|
// avty_json["t"] = tpl;
|
||||||
avty_json["val_tpl"] = tpl;
|
// snprintf(tpl, sizeof(tpl), tpl_draft, "value == 'online'");
|
||||||
avty.add(avty_json); // returns 0 if no mem
|
// avty_json["val_tpl"] = tpl;
|
||||||
|
// avty.add(avty_json); // returns 0 if no mem
|
||||||
|
|
||||||
// skip conditional Jinja2 templates if not home assistant
|
// skip conditional Jinja2 templates if not home assistant
|
||||||
if (discovery_type() == discoveryType::HOMEASSISTANT) {
|
if (discovery_type() == discoveryType::HOMEASSISTANT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user