merge PR #901 - added dhw alternating operation

This commit is contained in:
Proddy
2023-01-22 12:17:39 +01:00
parent 66d5d3db8c
commit 7f5e3d3b4c
7 changed files with 128 additions and 14 deletions

View File

@@ -912,8 +912,8 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model,
ids.add(ha_device);
if (create_device_config) {
auto cap_name = strdup(device_type_name);
cap_name[0] = toupper(cap_name[0]); // capitalize
auto cap_name = strdup(device_type_name);
Helpers::CharToUpperUTF8(cap_name); // capitalize first letter
dev_json["name"] = std::string("EMS-ESP ") + cap_name;
dev_json["mf"] = brand;
dev_json["mdl"] = model;
@@ -1009,7 +1009,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
if (tag == DeviceValueTAG::TAG_NONE) {
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, EMSdevice::tag_to_string(tag), Helpers::toLower(uniq_s).c_str());
snprintf(uniq_id, sizeof(uniq_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag, false), Helpers::toLower(uniq_s).c_str());
}
}
@@ -1138,7 +1138,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
// friendly name = <tag> <name>
char ha_name[70];
char * F_name = strdup(fullname);
F_name[0] = toupper(F_name[0]); // capitalize first letter
Helpers::CharToUpperUTF8(F_name); // capitalize first letter
if (tag != DeviceValueTAG::TAG_NONE) {
snprintf(ha_name, sizeof(ha_name), "%s %s", EMSdevice::tag_to_string(tag), F_name);
} else {