Check if incomming message contains anything.
This commit is contained in:
@@ -70,7 +70,7 @@ void incomingMessage(const MyMessage &message) {
|
|||||||
Serial.println("This is an ack from gateway");
|
Serial.println("This is an ack from gateway");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type==V_LIGHT) {
|
if (message.type == V_LIGHT && strlen(msg.getString()) != 0) {
|
||||||
// Change relay state
|
// Change relay state
|
||||||
state = message.getBool();
|
state = message.getBool();
|
||||||
digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
|
digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
|
||||||
|
|||||||
Reference in New Issue
Block a user