From eafe358deb379df5f9f18da44f88745c559d7e3f Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 30 Nov 2022 21:18:15 +0100 Subject: [PATCH] shower uses mqtt base - #759 --- src/shower.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/shower.cpp b/src/shower.cpp index d2cb1c678..01fa187cb 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -151,10 +151,13 @@ void Shower::set_shower_state(bool state, bool force) { ha_configdone_ = true; StaticJsonDocument doc; - doc["name"] = "Shower Active"; - doc["uniq_id"] = "shower_active"; - doc["~"] = Mqtt::base(); - doc["stat_t"] = "~/shower_active"; + 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"; // always render boolean as strings for HA char result[12];