mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
fix custom name saving
This commit is contained in:
@@ -945,7 +945,7 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
|||||||
|
|
||||||
// n is the fullname, and can be optional
|
// n is the fullname, and can be optional
|
||||||
// don't add the fullname if its a command
|
// don't add the fullname if its a command
|
||||||
auto fullname = dv.get_fullname();
|
auto fullname = Helpers::translated_word(dv.fullname);
|
||||||
if (dv.type != DeviceValueType::CMD) {
|
if (dv.type != DeviceValueType::CMD) {
|
||||||
if (!fullname.empty()) {
|
if (!fullname.empty()) {
|
||||||
if ((dv.tag == DeviceValueTAG::TAG_NONE) || tag_to_string(dv.tag).empty()) {
|
if ((dv.tag == DeviceValueTAG::TAG_NONE) || tag_to_string(dv.tag).empty()) {
|
||||||
@@ -1002,9 +1002,11 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) {
|
|||||||
// always write the mask
|
// always write the mask
|
||||||
dv.state = ((dv.state & 0x0F) | (new_mask << 4)); // set state high bits to flag
|
dv.state = ((dv.state & 0x0F) | (new_mask << 4)); // set state high bits to flag
|
||||||
|
|
||||||
// set the custom name if it has one
|
// set the custom name if it has one, or clear it
|
||||||
if (has_custom_name) {
|
if (has_custom_name) {
|
||||||
dv.custom_fullname = entity_id.substr(custom_name_pos + 1);
|
dv.custom_fullname = entity_id.substr(custom_name_pos + 1);
|
||||||
|
} else {
|
||||||
|
dv.custom_fullname = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user