This commit is contained in:
MichaelDvP
2024-10-24 08:02:42 +02:00
8 changed files with 54 additions and 47 deletions

View File

@@ -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

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'}}";
// 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) {

View File

@@ -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