From af5c54f610d66575e0182c7d51131e0a5990f73b Mon Sep 17 00:00:00 2001 From: tuzzmaniandevil Date: Tue, 5 Sep 2017 16:31:04 +1200 Subject: [PATCH 1/2] Add an option to query relay status --- code/espurna/relay.ino | 7 ++++--- code/espurna/web.ino | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 456b6b06..7f476572 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -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 diff --git a/code/espurna/web.ino b/code/espurna/web.ino index eed32a45..4f349897 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -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(); From a4de1ddecf47f3f59bc79e38c14ea66dc71b1275 Mon Sep 17 00:00:00 2001 From: Hermann Kraus Date: Mon, 9 Oct 2017 00:07:08 +0200 Subject: [PATCH 2/2] Make building the web interface easier by automatically installing the dependencies. --- code/build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/build.sh b/code/build.sh index 3c051dc8..7dec02e2 100755 --- a/code/build.sh +++ b/code/build.sh @@ -28,6 +28,12 @@ echo "Building for version $version" # Create output folder mkdir -p firmware +if [ ! -e node_modules/gulp/bin/gulp.js ]; then + echo "--------------------------------------------------------------" + echo "Installing dependencies..." + npm install --only=dev +fi + # Recreate web interface echo "--------------------------------------------------------------" echo "Building web interface..."