1 parent
cf0f53507d
commit
5c3eccbb18
3 files changed
+32
-2
No files matched your search
+17
-1
@@ -44,7 +44,23 @@ void MQTTtoONOFF(char* topicOri, JsonObject& ONOFFdata) {
|
||||
// we acknowledge the sending by publishing the value to an acknowledgement topic
|
||||
pub(subjectGTWONOFFtoMQTT, ONOFFdata);
|
||||
} else {
|
||||
Log.error(F("MQTTtoONOFF failed json read" CR));
|
||||
if (ONOFFdata["cmd"] == "high_pulse") {
|
||||
Log.notice(F("MQTTtoONOFF high_pulse ok" CR));
|
||||
Log.notice(F("GPIO number: %d" CR), gpio);
|
||||
pinMode(gpio, OUTPUT);
|
||||
digitalWrite(gpio, HIGH);
|
||||
delay(500);
|
||||
digitalWrite(gpio, LOW);
|
||||
} else if (ONOFFdata["cmd"] == "low_pulse") {
|
||||
Log.notice(F("MQTTtoONOFF low_pulse ok" CR));
|
||||
Log.notice(F("GPIO number: %d" CR), gpio);
|
||||
pinMode(gpio, OUTPUT);
|
||||
digitalWrite(gpio, LOW);
|
||||
delay(500);
|
||||
digitalWrite(gpio, HIGH);
|
||||
} else {
|
||||
Log.error(F("MQTTtoONOFF failed json read" CR));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user