publish ha only if ha is enabled

This commit is contained in:
proddy
2025-12-19 16:35:55 +01:00
parent 48b261317d
commit eec373e2ae

View File

@@ -383,12 +383,6 @@ void WebCustomEntityService::publish() {
return; return;
} }
if (Mqtt::publish_single()) {
for (CustomEntityItem & entityItem : *customEntityItems_) {
publish_single(entityItem);
}
}
JsonDocument doc; JsonDocument doc;
JsonObject output = doc.to<JsonObject>(); JsonObject output = doc.to<JsonObject>();
bool ha_created = ha_configdone_; bool ha_created = ha_configdone_;
@@ -399,7 +393,7 @@ void WebCustomEntityService::publish() {
} }
render_value(output, entityItem); render_value(output, entityItem);
// create HA config // create HA config
if (!ha_configdone_) { if (Mqtt::ha_enabled() && !ha_configdone_) {
JsonDocument config; JsonDocument config;
config["~"] = Mqtt::base(); config["~"] = Mqtt::base();