From b4e376fe0570a74d3026689fc9e49860d4af57d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 6 Jun 2016 15:48:44 +0200 Subject: [PATCH] Added MQTT toggle message --- code/src/code.ino | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/src/code.ino b/code/src/code.ino index 27bb3e26..20341c35 100644 --- a/code/src/code.ino +++ b/code/src/code.ino @@ -547,11 +547,17 @@ void wifiLoop() { Serial.println(); #endif - isMQTTMessage = true; + // Action to perform + if ((char)payload[0] == '0') { + isMQTTMessage = true; + switchRelayOff(); + } if ((char)payload[0] == '1') { + isMQTTMessage = true; switchRelayOn(); - } else { - switchRelayOff(); + } + if ((char)payload[0] == '2') { + toggleRelay(); } isMQTTMessage = false;