diff --git a/src/shower.cpp b/src/shower.cpp index 01fa187cb..fa43a6f05 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -151,13 +151,17 @@ void Shower::set_shower_state(bool state, bool force) { ha_configdone_ = true; StaticJsonDocument doc; + doc["name"] = "Shower Active"; + char str[70]; snprintf(str, sizeof(str), "%s_shower_active", Mqtt::basename().c_str()); doc["uniq_id"] = str; doc["object_id"] = str; - doc["~"] = Mqtt::base(); - doc["stat_t"] = "~/shower_active"; + + char stat_t[50]; + snprintf(stat_t, sizeof(stat_t), "%s/shower_active", Mqtt::base().c_str()); // use base path + doc["stat_t"] = stat_t; // always render boolean as strings for HA char result[12]; @@ -169,7 +173,7 @@ void Shower::set_shower_state(bool state, bool force) { ids.add("ems-esp"); char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; - snprintf(topic, sizeof(topic), "binary_sensor/%s/shower_active/config", Mqtt::base().c_str()); + snprintf(topic, sizeof(topic), "binary_sensor/%s/shower_active/config", Mqtt::basename().c_str()); Mqtt::publish_ha(topic, doc.as()); // publish the config payload with retain flag } }