Check alarm/state change field

main
Filip B P 2 years ago
parent 6cb2ad48a9
commit 9ac58c65f1

@ -84,6 +84,7 @@ void callback(char* topic, byte* payload, unsigned int length) {
} }
else if (strcmp(topic, "alarm/state") == 0) else if (strcmp(topic, "alarm/state") == 0)
{ {
if (doc["changed"] == true) {
if (strcmp(doc["status"], "Armed") == 0) if (strcmp(doc["status"], "Armed") == 0)
{ {
if (bool reed = digitalRead(REED_ACTIVATION_PIN) == 1) if (bool reed = digitalRead(REED_ACTIVATION_PIN) == 1)
@ -100,6 +101,7 @@ void callback(char* topic, byte* payload, unsigned int length) {
} }
} }
} }
}
} }

Loading…
Cancel
Save