Fix lost data connection detection

This commit is contained in:
Djuri 2024-01-31 23:45:26 +01:00
parent 9cb4b97146
commit e4a39de5fc
9 changed files with 80 additions and 10 deletions

View file

@ -24,6 +24,10 @@ void setupWebserver() {
server.on("/api/full_refresh", HTTP_GET, onApiFullRefresh);
server.on("/api/stop_datasources", HTTP_GET, onApiStopDataSources);
server.on("/api/restart_datasources", HTTP_GET, onApiRestartDataSources);
server.on("/api/action/pause", HTTP_GET, onApiActionPause);
server.on("/api/action/timer_restart", HTTP_GET, onApiActionTimerRestart);
@ -694,6 +698,28 @@ void onApiLightsStatus(AsyncWebServerRequest *request) {
request->send(response);
}
void onApiStopDataSources(AsyncWebServerRequest *request) {
AsyncResponseStream *response =
request->beginResponseStream("application/json");
stopPriceNotify();
stopBlockNotify();
request->send(response);
}
void onApiRestartDataSources(AsyncWebServerRequest *request) {
AsyncResponseStream *response =
request->beginResponseStream("application/json");
stopPriceNotify();
stopBlockNotify();
setupPriceNotify();
setupBlockNotify();
request->send(response);
}
void onApiLightsOff(AsyncWebServerRequest *request) {
setLights(0, 0, 0);
request->send(200);