mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 09:49:32 +02:00
Add configurable Sofar ID via Webserver
This commit is contained in:
parent
25c60cb42b
commit
920cd83561
6 changed files with 39 additions and 3 deletions
|
@ -487,6 +487,20 @@ void init_webserver() {
|
|||
}
|
||||
});
|
||||
|
||||
// Route for editing Sofar ID
|
||||
server.on("/updateSofarID", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password))
|
||||
return request->requestAuthentication();
|
||||
if (request->hasParam("value")) {
|
||||
String value = request->getParam("value")->value();
|
||||
datalayer.battery.settings.sofar_user_specified_battery_id = value.toInt();
|
||||
store_settings();
|
||||
request->send(200, "text/plain", "Updated successfully");
|
||||
} else {
|
||||
request->send(400, "text/plain", "Bad Request");
|
||||
}
|
||||
});
|
||||
|
||||
// Route for editing Wh
|
||||
server.on("/updateBatterySize", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue