Browse Source

Add an option to query relay status

fastled
tuzzmaniandevil 7 years ago
parent
commit
af5c54f610
2 changed files with 5 additions and 4 deletions
  1. +4
    -3
      code/espurna/relay.ino
  2. +1
    -1
      code/espurna/web.ino

+ 4
- 3
code/espurna/relay.ino View File

@ -335,13 +335,14 @@ unsigned char relayParsePayload(const char * payload) {
value = 1;
} else if (strcmp(p, "toggle") == 0) {
value = 2;
} else if (strcmp(p, "query") == 0) {
value = 3;
} else {
value = p[0] - '0';
}
if (0 <= value && value <=2) return value;
return 0x99;
if (0 <= value && value <=3) return value;
return 0xFF;
}
//------------------------------------------------------------------------------
// REST API


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

@ -142,7 +142,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
if (data.containsKey("status")) {
unsigned char value = relayParsePayload(data["status"]);
if (value == 0xFF) {
if (value == 3) {
relayWS();


Loading…
Cancel
Save