mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
fixes #1338
This commit is contained in:
@@ -569,6 +569,7 @@ void EMSdevice::add_device_value(uint8_t tag, // to b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ignore) {
|
if (ignore) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1045,8 +1046,9 @@ void EMSdevice::generate_values_web_customization(JsonArray output) {
|
|||||||
if (dv.type != DeviceValueType::CMD) {
|
if (dv.type != DeviceValueType::CMD) {
|
||||||
if (fullname) {
|
if (fullname) {
|
||||||
if (dv.has_tag()) {
|
if (dv.has_tag()) {
|
||||||
char name[50];
|
char name[80];
|
||||||
snprintf(name, sizeof(name), "%s %s", tag_to_string(dv.tag), fullname);
|
// TODO check TAG https://github.com/emsesp/EMS-ESP32/issues/1338
|
||||||
|
snprintf(name, sizeof(name), "%s %s", fullname, tag_to_string(dv.tag)); // suffix tag
|
||||||
obj["n"] = name;
|
obj["n"] = name;
|
||||||
} else {
|
} else {
|
||||||
obj["n"] = fullname;
|
obj["n"] = fullname;
|
||||||
@@ -1396,8 +1398,9 @@ bool EMSdevice::get_value_info(JsonObject output, const char * cmd, const int8_t
|
|||||||
auto fullname = dv.get_fullname();
|
auto fullname = dv.get_fullname();
|
||||||
if (!fullname.empty()) {
|
if (!fullname.empty()) {
|
||||||
if (dv.has_tag()) {
|
if (dv.has_tag()) {
|
||||||
char name[50];
|
char name[80];
|
||||||
snprintf(name, sizeof(name), "%s %s", tag_to_string(dv.tag), fullname.c_str());
|
// TODO check TAG https://github.com/emsesp/EMS-ESP32/issues/1338
|
||||||
|
snprintf(name, sizeof(name), "%s %s", fullname.c_str(), tag_to_string(dv.tag)); // suffix tag
|
||||||
json["fullname"] = name;
|
json["fullname"] = name;
|
||||||
} else {
|
} else {
|
||||||
json["fullname"] = fullname;
|
json["fullname"] = fullname;
|
||||||
@@ -1596,16 +1599,18 @@ bool EMSdevice::generate_values(JsonObject output, const uint8_t tag_filter, con
|
|||||||
char name[80];
|
char name[80];
|
||||||
|
|
||||||
if (output_target == OUTPUT_TARGET::API_VERBOSE || output_target == OUTPUT_TARGET::CONSOLE) {
|
if (output_target == OUTPUT_TARGET::API_VERBOSE || output_target == OUTPUT_TARGET::CONSOLE) {
|
||||||
char short_name[20];
|
// char short_name[20];
|
||||||
if (output_target == OUTPUT_TARGET::CONSOLE) {
|
// if (output_target == OUTPUT_TARGET::CONSOLE) {
|
||||||
snprintf(short_name, sizeof(short_name), " (%s)", dv.short_name);
|
// snprintf(short_name, sizeof(short_name), "(%s)", dv.short_name);
|
||||||
} else {
|
// } else {
|
||||||
strcpy(short_name, "");
|
// strcpy(short_name, "");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (have_tag) {
|
if (have_tag) {
|
||||||
snprintf(name, sizeof(name), "%s %s%s", tag_to_string(dv.tag), fullname.c_str(), short_name); // prefix the tag
|
// TODO check TAG https://github.com/emsesp/EMS-ESP32/issues/1338
|
||||||
|
snprintf(name, sizeof(name), "%s %s (%s)", fullname.c_str(), tag_to_string(dv.tag), dv.short_name); // add the tag
|
||||||
} else {
|
} else {
|
||||||
snprintf(name, sizeof(name), "%s%s", fullname.c_str(), short_name);
|
snprintf(name, sizeof(name), "%s (%s)", fullname.c_str(), dv.short_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strlcpy(name, (dv.short_name), sizeof(name)); // use short name
|
strlcpy(name, (dv.short_name), sizeof(name)); // use short name
|
||||||
|
|||||||
Reference in New Issue
Block a user