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'.
This commit is contained in:
pswid
2023-03-12 21:24:03 +01:00
parent 62c3c91665
commit 944aa861f8

View File

@@ -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 {