mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev
This commit is contained in:
@@ -1745,7 +1745,6 @@ void EMSESP::loop() {
|
||||
int c = serial_console_.read();
|
||||
if (c != -1) {
|
||||
show_prompt = true;
|
||||
Serial.println(c);
|
||||
}
|
||||
// https://daleswanson.org/ascii.htm#:~:text=0
|
||||
// CTRL-D to open
|
||||
|
||||
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'}}";
|
||||
|
||||
// condition 1
|
||||
avty_json.clear();
|
||||
avty_json["t"] = state;
|
||||
snprintf(tpl, sizeof(tpl), tpl_draft, cond1 == nullptr ? "value is defined" : cond1);
|
||||
avty_json["val_tpl"] = tpl;
|
||||
avty.add(avty_json); // returns 0 if no mem
|
||||
if (cond1 != nullptr) {
|
||||
avty_json.clear();
|
||||
avty_json["t"] = state;
|
||||
snprintf(tpl, sizeof(tpl), tpl_draft, cond1);
|
||||
avty_json["val_tpl"] = tpl;
|
||||
avty.add(avty_json); // returns 0 if no mem
|
||||
}
|
||||
|
||||
// condition 2
|
||||
if (cond2 != nullptr) {
|
||||
|
||||
@@ -204,7 +204,7 @@ void Shower::set_shower_state(bool state, bool force) {
|
||||
|
||||
Mqtt::add_ha_bool(doc);
|
||||
|
||||
Mqtt::add_ha_sections_to_doc("shower", stat_t, doc, true); // create first dev & ids
|
||||
Mqtt::add_ha_sections_to_doc("shower", stat_t, doc, true); // create first dev & ids, no conditions
|
||||
|
||||
snprintf(topic, sizeof(topic), "binary_sensor/%s/shower_active/config", Mqtt::basename().c_str());
|
||||
ha_configdone_ = Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
|
||||
|
||||
Reference in New Issue
Block a user