support 3 types of MQTT discovery entity id

This commit is contained in:
proddy
2022-12-17 19:20:31 +01:00
parent 4b7bbb3d50
commit 783ea7901c
19 changed files with 71 additions and 59 deletions

View File

@@ -155,7 +155,7 @@ void Shower::set_shower_state(bool state, bool force) {
doc["name"] = "Shower Active";
char str[70];
if (Mqtt::multiple_instances()) {
if (Mqtt::entity_format() == 2) {
snprintf(str, sizeof(str), "%s_shower_active", Mqtt::basename().c_str());
} else {
snprintf(str, sizeof(str), "shower_active"); // v3.4 compatible