1 parent
cf0f53507d
commit
5c3eccbb18
3 files changed
+32
-2
No files matched your search
@@ -19,6 +19,20 @@ OFF command:
|
||||
ON command:
|
||||
`mosquitto_pub -t home/OpenMQTTGateway_MEGA/commands/MQTTtoONOFF -m '{"gpio":15,"cmd":1}'`
|
||||
|
||||
Since v0.9.9, you could ask for a short activation, the PIN will change state for only half a second.
|
||||
|
||||
For example you could use it with a relay board to activate an existing step relay. So your home automation act as a supplementary switch and do not interfere with the existing switch in your house.
|
||||
|
||||
It's available only with [json receiving](../upload/pio.md#api):
|
||||
|
||||
Goes ON for half a second, then back to OFF:
|
||||
`mosquitto_pub -t home/OpenMQTTGateway_MEGA/commands/MQTTtoONOFF -m '{"gpio":15,"cmd":"high_pulse"}'`
|
||||
|
||||
Goes OFF for half a second, then back to ON:
|
||||
`mosquitto_pub -t home/OpenMQTTGateway_MEGA/commands/MQTTtoONOFF -m '{"gpio":15,"cmd":"low_pulse}"'`
|
||||
|
||||
Be aware that outputs are OFF by default when the board first start.
|
||||
|
||||
## FASTLED
|
||||
### The FASTLED module support 2 different operation modes
|
||||
1. control one specific RGB LED
|
||||
|
||||
+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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user