From befd21f8cb051c33f96891bfdaeb2460704fe9b4 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 30 Nov 2025 23:27:18 +0100 Subject: [PATCH] fixe #2780 --- src/web/WebCustomEntityService.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/web/WebCustomEntityService.cpp b/src/web/WebCustomEntityService.cpp index b489a9bc5..e7c5260ed 100644 --- a/src/web/WebCustomEntityService.cpp +++ b/src/web/WebCustomEntityService.cpp @@ -411,8 +411,10 @@ void WebCustomEntityService::publish(const bool force) { // create HA config if (Mqtt::ha_enabled() && !ha_registered_) { JsonDocument config; + config["~"] = Mqtt::base(); + char stat_t[50]; - snprintf(stat_t, sizeof(stat_t), "%s/%s_data", Mqtt::base().c_str(), F_(custom)); + snprintf(stat_t, sizeof(stat_t), "~/%s_data", F_(custom)); config["stat_t"] = stat_t; char val_obj[50]; @@ -445,7 +447,7 @@ void WebCustomEntityService::publish(const bool force) { snprintf(topic, sizeof(topic), "sensor/%s/%s_%s/config", Mqtt::basename().c_str(), F_(custom), entityItem.name.c_str()); } char command_topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; - snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::base().c_str(), F_(custom), entityItem.name.c_str()); + snprintf(command_topic, sizeof(command_topic), "~/%s/%s", F_(custom), entityItem.name.c_str()); config["cmd_t"] = command_topic; } else { if (entityItem.value_type == DeviceValueType::BOOL) {