Merge pull request #1277 from dalathegreat/feature/sofar-multiple-packs

Feature: Sofar CAN protocol 
This commit is contained in:
Daniel Öster 2025-07-16 21:30:25 +03:00 committed by GitHub
commit 2de724e1d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 119 additions and 8 deletions

View file

@ -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))