diff --git a/interface/src/project/DashboardSensorsAnalogDialog.tsx b/interface/src/project/DashboardSensorsAnalogDialog.tsx index 290354747..f66f700a3 100644 --- a/interface/src/project/DashboardSensorsAnalogDialog.tsx +++ b/interface/src/project/DashboardSensorsAnalogDialog.tsx @@ -137,7 +137,7 @@ const DashboardSensorsAnalogDialog = ({ @@ -1159,7 +1159,7 @@ bool Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, char min_s[10]; char max_s[10]; - snprintf(topic, sizeof(topic), "climate/%s/thermostat_hc%d/config", mqtt_basename_.c_str(), hc_num); + snprintf(topic, sizeof(topic), "climate/%s/thermostat_hc%d/config", Mqtt::basename().c_str(), hc_num); if (remove) { return queue_remove_topic(topic); // publish empty payload with retain flag } @@ -1202,7 +1202,7 @@ bool Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, snprintf(name_s, sizeof(name_s), "Hc%d", hc_num); if (Mqtt::entity_format() == entityFormat::MULTI_SHORT) { - snprintf(uniq_id_s, sizeof(uniq_id_s), "%s_thermostat_hc%d", mqtt_basename_.c_str(), hc_num); // add basename + snprintf(uniq_id_s, sizeof(uniq_id_s), "%s_thermostat_hc%d", Mqtt::basename().c_str(), hc_num); // add basename } else { snprintf(uniq_id_s, sizeof(uniq_id_s), "thermostat_hc%d", hc_num); // backward compatible with v3.4 } @@ -1212,7 +1212,7 @@ bool Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, StaticJsonDocument doc; // 1024 is not enough - doc["~"] = mqtt_base_; + doc["~"] = Mqtt::base(); doc["uniq_id"] = uniq_id_s; doc["obj_id"] = uniq_id_s; // same as uniq_id doc["name"] = name_s; @@ -1279,7 +1279,7 @@ void Mqtt::add_avty_to_doc(const char * state_t, const JsonObject & doc, const c StaticJsonDocument<512> avty_json; - snprintf(tpl, sizeof(tpl), "%s/status", mqtt_base_.c_str()); + snprintf(tpl, sizeof(tpl), "%s/status", Mqtt::base().c_str()); avty_json["t"] = tpl; snprintf(tpl, sizeof(tpl), tpl_draft, "value == 'online'"); avty_json["val_tpl"] = tpl; diff --git a/src/shower.cpp b/src/shower.cpp index 09b67d85c..d95c97e3c 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -195,7 +195,7 @@ void Shower::set_shower_state(bool state, bool force) { doc["uniq_id"] = str; doc["object_id"] = str; - snprintf(stat_t, sizeof(stat_t), "%s/shower_active", Mqtt::basename().c_str()); + snprintf(stat_t, sizeof(stat_t), "%s/shower_active", Mqtt::base().c_str()); doc["stat_t"] = stat_t; if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) { @@ -229,7 +229,7 @@ void Shower::set_shower_state(bool state, bool force) { doc["uniq_id"] = str; doc["object_id"] = str; - snprintf(stat_t, sizeof(stat_t), "%s/shower_data", Mqtt::basename().c_str()); + snprintf(stat_t, sizeof(stat_t), "%s/shower_data", Mqtt::base().c_str()); doc["stat_t"] = stat_t; doc["name"] = "Shower Duration"; @@ -258,7 +258,7 @@ void Shower::set_shower_state(bool state, bool force) { doc["uniq_id"] = str; doc["object_id"] = str; - snprintf(stat_t, sizeof(stat_t), "%s/shower_data", Mqtt::basename().c_str()); + snprintf(stat_t, sizeof(stat_t), "%s/shower_data", Mqtt::base().c_str()); doc["stat_t"] = stat_t; doc["name"] = "Shower Timestamp"; diff --git a/src/web/WebCustomEntityService.cpp b/src/web/WebCustomEntityService.cpp index f4c2d9d47..74cfcbc1e 100644 --- a/src/web/WebCustomEntityService.cpp +++ b/src/web/WebCustomEntityService.cpp @@ -358,7 +358,7 @@ void WebCustomEntityService::publish(const bool force) { if (Mqtt::ha_enabled() && !ha_registered_) { StaticJsonDocument config; char stat_t[50]; - snprintf(stat_t, sizeof(stat_t), "%s/custom_data", Mqtt::basename().c_str()); + snprintf(stat_t, sizeof(stat_t), "%s/custom_data", Mqtt::base().c_str()); config["stat_t"] = stat_t; char val_obj[50]; diff --git a/src/web/WebSchedulerService.cpp b/src/web/WebSchedulerService.cpp index a11a71104..f7c61b1e3 100644 --- a/src/web/WebSchedulerService.cpp +++ b/src/web/WebSchedulerService.cpp @@ -254,7 +254,7 @@ void WebSchedulerService::publish(const bool force) { if (Mqtt::ha_enabled() && !ha_registered_) { StaticJsonDocument config; char stat_t[50]; - snprintf(stat_t, sizeof(stat_t), "%s/scheduler_data", Mqtt::basename().c_str()); + snprintf(stat_t, sizeof(stat_t), "%s/scheduler_data", Mqtt::base().c_str()); config["stat_t"] = stat_t; char val_obj[50]; @@ -273,7 +273,7 @@ void WebSchedulerService::publish(const bool force) { char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; char command_topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; snprintf(topic, sizeof(topic), "switch/%s/scheduler_%s/config", Mqtt::basename().c_str(), scheduleItem.name.c_str()); - snprintf(command_topic, sizeof(command_topic), "%s/scheduler/%s", Mqtt::basename().c_str(), scheduleItem.name.c_str()); + snprintf(command_topic, sizeof(command_topic), "%s/scheduler/%s", Mqtt::base().c_str(), scheduleItem.name.c_str()); config["cmd_t"] = command_topic; if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) { config["pl_on"] = true;