fix add_ha_sections_to_doc calls

This commit is contained in:
Proddy
2024-01-04 18:11:08 +01:00
parent e62fc14b6d
commit df33a24951

View File

@@ -210,7 +210,7 @@ void Shower::set_shower_state(bool state, bool force) {
doc["pl_off"] = Helpers::render_boolean(result, false); doc["pl_off"] = Helpers::render_boolean(result, false);
} }
Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), true); Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), true); // create first dev & ids
snprintf(topic, sizeof(topic), "binary_sensor/%s/shower_active/config", Mqtt::basename().c_str()); 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 ha_configdone_ = Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
@@ -235,7 +235,7 @@ void Shower::set_shower_state(bool state, bool force) {
doc["dev_cla"] = "duration"; doc["dev_cla"] = "duration";
// doc["ent_cat"] = "diagnostic"; // doc["ent_cat"] = "diagnostic";
Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), "value_json.duration is defined"); Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), false, "value_json.duration is defined");
snprintf(topic, sizeof(topic), "sensor/%s/shower_duration/config", Mqtt::basename().c_str()); snprintf(topic, sizeof(topic), "sensor/%s/shower_duration/config", Mqtt::basename().c_str());
Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
@@ -257,7 +257,7 @@ void Shower::set_shower_state(bool state, bool force) {
doc["val_tpl"] = "{{value_json.timestamp if value_json.timestamp is defined else 0}}"; doc["val_tpl"] = "{{value_json.timestamp if value_json.timestamp is defined else 0}}";
// doc["ent_cat"] = "diagnostic"; // doc["ent_cat"] = "diagnostic";
Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), "value_json.timestamp is defined"); Mqtt::add_ha_sections_to_doc("shower", stat_t, doc.as<JsonObject>(), false, "value_json.timestamp is defined");
snprintf(topic, sizeof(topic), "sensor/%s/shower_timestamp/config", Mqtt::basename().c_str()); snprintf(topic, sizeof(topic), "sensor/%s/shower_timestamp/config", Mqtt::basename().c_str());
Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag Mqtt::queue_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag