mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
remove all from customizations only removes the entities, not the sensors ('as' and 'ts')
This commit is contained in:
@@ -160,17 +160,19 @@ StateUpdateResult WebCustomization::update(JsonObject root, WebCustomization & c
|
|||||||
// deletes the customization file
|
// deletes the customization file
|
||||||
void WebCustomizationService::reset_customization(AsyncWebServerRequest * request) {
|
void WebCustomizationService::reset_customization(AsyncWebServerRequest * request) {
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
if (LittleFS.remove(EMSESP_CUSTOMIZATION_FILE)) {
|
|
||||||
AsyncWebServerResponse * response = request->beginResponse(205); // restart needed
|
EMSESP::webCustomizationService.update([](WebCustomization & settings) {
|
||||||
|
// remove entityCustomizations
|
||||||
|
settings.entityCustomizations.clear(); // clear the masked_entities list
|
||||||
|
return StateUpdateResult::CHANGED;
|
||||||
|
});
|
||||||
|
|
||||||
|
AsyncWebServerResponse * response = request->beginResponse(200);
|
||||||
request->send(response);
|
request->send(response);
|
||||||
emsesp::EMSESP::system_.systemStatus(
|
emsesp::EMSESP::system_.systemStatus(
|
||||||
emsesp::SYSTEM_STATUS::SYSTEM_STATUS_PENDING_RESTART); // will be handled by the main loop. We use pending for the Web's SystemMonitor
|
emsesp::SYSTEM_STATUS::SYSTEM_STATUS_PENDING_RESTART); // will be handled by the main loop. We use pending for the Web's SystemMonitor
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// failed
|
|
||||||
AsyncWebServerResponse * response = request->beginResponse(400); // bad request
|
|
||||||
request->send(response);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user