Browse Source

Allow to change relay status using GET requests

fastled
Xose Pérez 7 years ago
parent
commit
cb393867d1
2 changed files with 5 additions and 4 deletions
  1. +2
    -1
      code/espurna/relay.ino
  2. +3
    -3
      code/espurna/web.ino

+ 2
- 1
code/espurna/relay.ino View File

@ -253,7 +253,8 @@ void relaySetupAPI() {
} else {
relayStatus(relayID, value == 1);
}
});
}
);
}


+ 3
- 3
code/espurna/web.ino View File

@ -587,9 +587,9 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) {
bool asJson = _asJson(request);
web_api_t api = _apis[apiID];
if (request->method() == HTTP_PUT) {
if (request->hasParam("value", true)) {
AsyncWebParameter* p = request->getParam("value", true);
if (api.putFn != NULL) {
if (request->hasParam("value", request->method() == HTTP_PUT)) {
AsyncWebParameter* p = request->getParam("value", request->method() == HTTP_PUT);
(api.putFn)((p->value()).c_str());
}
}


Loading…
Cancel
Save