From ecafda86f180e9ec98bd5b87bbb3d4aa42569499 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Sun, 12 Mar 2023 19:14:28 +0100 Subject: [PATCH 1/3] fix: tags in names in HA were not translated --- src/mqtt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 00039d1d7..a665fa163 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1152,7 +1152,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev Helpers::CharToUpperUTF8(F_name); // capitalize first letter if (has_tag) { // exclude heartbeat tag - snprintf(ha_name, sizeof(ha_name), "%s %s", DeviceValue::DeviceValueTAG_s[tag][0], F_name); + snprintf(ha_name, sizeof(ha_name), "%s %s", EMSdevice::tag_to_string(tag), F_name); } else { snprintf(ha_name, sizeof(ha_name), "%s", F_name); // no tag } From 62c3c91665ffaba3125158744c9cfe92497a1902 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Sun, 12 Mar 2023 20:02:07 +0100 Subject: [PATCH 2/3] fixed entity id format v.3.4 --- src/mqtt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index a665fa163..65f47d54d 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1011,9 +1011,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev strlcpy(uniq_s, en_name, sizeof(uniq_s)); Helpers::replace_char(uniq_s, ' ', '_'); if (has_tag) { - snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str()); - } else { snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, DeviceValue::DeviceValueTAG_s[tag][0], Helpers::toLower(uniq_s).c_str()); + } else { + snprintf(uniq_id, sizeof(uniq_id), "%s_%s", device_name, Helpers::toLower(uniq_s).c_str()); } } From 944aa861f88d05ab881eebbe02182e5dba0157b8 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Sun, 12 Mar 2023 21:24:03 +0100 Subject: [PATCH 3/3] make 'eco+ switch_off' enity unique in v.3.4 format HA ignores characters '+' in uniq_id/obj_id, so to make the entity 'eco+ switch_off' different from 'eco switch_off', it will be renamed to 'eco2 switch_off'. --- src/mqtt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 65f47d54d..22356b6da 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1010,6 +1010,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev char uniq_s[60]; strlcpy(uniq_s, en_name, sizeof(uniq_s)); Helpers::replace_char(uniq_s, ' ', '_'); + Helpers::replace_char(uniq_s, '+', '2'); //changes 'eco+_switch_off' to 'eco2_switch_off' (HA ignores '+') if (has_tag) { snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, DeviceValue::DeviceValueTAG_s[tag][0], Helpers::toLower(uniq_s).c_str()); } else {