mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
use add_ha_sections_to_doc(), add via_device, add check for domoticz
This commit is contained in:
@@ -426,13 +426,8 @@ void WebCustomEntityService::publish(const bool force) {
|
||||
config["pl_off"] = Helpers::render_boolean(result, false);
|
||||
}
|
||||
}
|
||||
JsonObject dev = config.createNestedObject("dev");
|
||||
dev["name"] = Mqtt::basename() + " Custom";
|
||||
JsonArray ids = dev.createNestedArray("ids");
|
||||
ids.add(Mqtt::basename() + "-custom");
|
||||
Mqtt::add_ha_sections_to_doc("custom", stat_t, config.as<JsonObject>(), true, val_cond);
|
||||
|
||||
// add "availability" section
|
||||
Mqtt::add_avty_to_doc(stat_t, config.as<JsonObject>(), val_cond);
|
||||
ha_created |= Mqtt::queue_ha(topic, config.as<JsonObject>());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user