From 4d43307e9a103b52fb5dbcfb9c3e212b02c741ed Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 17 Oct 2026 15:07:25 +0200 Subject: [PATCH] #3290 --- src/web/WebCustomizationService.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/web/WebCustomizationService.cpp b/src/web/WebCustomizationService.cpp index 74974701d..00e301a2b 100644 --- a/src/web/WebCustomizationService.cpp +++ b/src/web/WebCustomizationService.cpp @@ -350,23 +350,29 @@ void WebCustomizationService::customization_entities(AsyncWebServerRequest * req // get list of entities that have masks set or a custom fullname emsdevice->getCustomizationEntities(entity_ids); - // Save the list to the customization file + // Save the list to the customization file. + // The same record holds the device custom name and brand, so keep those when replacing the entity list. update([&](WebCustomization & settings) { - // see if we already have a mask list for this device, if so remove the entry + std::string custom_name; + std::string custom_brand; + for (auto it = settings.entityCustomizations.begin(); it != settings.entityCustomizations.end();) { if ((*it).product_id == product_id && (*it).device_id == device_id) { - it = settings.entityCustomizations.erase(it); + custom_name = (*it).custom_name; + custom_brand = (*it).custom_brand; + it = settings.entityCustomizations.erase(it); break; } else { ++it; } } - // re-create a new entry EntityCustomization new_entry; - new_entry.product_id = product_id; - new_entry.device_id = device_id; - new_entry.entity_ids = entity_ids; + new_entry.product_id = product_id; + new_entry.device_id = device_id; + new_entry.custom_name = custom_name; + new_entry.custom_brand = custom_brand; + new_entry.entity_ids = entity_ids; settings.entityCustomizations.push_back(new_entry); return StateUpdateResult::CHANGED; // save the changes