fix mqtt base for shower

This commit is contained in:
proddy
2025-12-16 23:14:02 +01:00
parent f8cc688241
commit 12f4a74094

View File

@@ -196,9 +196,8 @@ void Shower::create_ha_discovery() {
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
char str[70]; char str[70];
doc["~"] = Mqtt::base();
// shower active // shower active
doc["~"] = Mqtt::base();
doc["name"] = "Shower Active"; doc["name"] = "Shower Active";
if (Mqtt::entity_format() == Mqtt::entityFormat::MULTI_SHORT) { if (Mqtt::entity_format() == Mqtt::entityFormat::MULTI_SHORT) {
@@ -219,13 +218,14 @@ void Shower::create_ha_discovery() {
// shower duration // shower duration
doc.clear(); doc.clear();
doc["~"] = Mqtt::base();
doc["name"] = "Shower Duration";
snprintf(str, sizeof(str), "%s_shower_duration", Mqtt::basename().c_str()); snprintf(str, sizeof(str), "%s_shower_duration", Mqtt::basename().c_str());
doc["uniq_id"] = str; doc["uniq_id"] = str;
doc["def_ent_id"] = (std::string) "sensor." + str; doc["def_ent_id"] = (std::string) "sensor." + str;
doc["stat_t"] = "~/shower_data"; doc["stat_t"] = "~/shower_data";
doc["name"] = "Shower Duration";
// don't bother with value template conditions if using Domoticz which doesn't fully support MQTT Discovery // don't bother with value template conditions if using Domoticz which doesn't fully support MQTT Discovery
if (Mqtt::discovery_type() == Mqtt::discoveryType::HOMEASSISTANT) { if (Mqtt::discovery_type() == Mqtt::discoveryType::HOMEASSISTANT) {