Adding low_pulse (#1120)

* Adding low_pulse
This commit is contained in:
Benoit Courty authored and GitHub committed 2022-01-01 19:47:23 -06:00
1 parent cf0f53507d
commit 5c3eccbb18
3 files changed
+32 -2

No files matched your search

+17 -1
View File
@@ -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));
}
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ extern void MQTTtoONOFF(char* topicOri, JsonObject& RFdata);
#define ONKey "setON"
#define OFFKey "setOFF"
#ifndef ACTUATOR_ON
# define ACTUATOR_ON LOW // 0 or 1, set to the output level of the gpio pin to turn the actuator on.
# define ACTUATOR_ON LOW // LOW or HIGH, set to the output level of the gpio pin to turn the actuator on.
#endif
#ifndef ACTUATOR_ONOFF_DEFAULT
# define ACTUATOR_ONOFF_DEFAULT !ACTUATOR_ON // ACTUATOR_ON or !ACTUATOR_ON, set to the state desired on reset.