Add acknowledgement to ONOFF gateway

#192
Publish to another topic the payload received
This commit is contained in:
Florian committed 2018-04-14 21:21:01 +02:00
1 parent 4b6b3992b2
commit 0412461d66
2 files changed
+6

No files matched your search

+5
View File
@@ -48,6 +48,11 @@ void MQTTtoONOFF(char * topicOri, char * datacallback){
trc(F("MQTTtoONOFF"));
trc(String(boolSWITCHTYPE));
digitalWrite(ACTUATOR_ONOFF_PIN, boolSWITCHTYPE);
boolean result = client.publish(subjectGTWONOFFtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic
if (result){
trc(F("MQTTtoONOFF ack pub."));
trc(String(datacallback));
}
}
}
#endif
+1
View File
@@ -27,6 +27,7 @@
/*----------------------------USER PARAMETERS-----------------------------*/
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
#define subjectMQTTtoONOFF Base_Topic Gateway_Name "/commands/MQTTtoONOFF"
#define subjectGTWONOFFtoMQTT Base_Topic Gateway_Name "/ONOFFtoMQTT"
/*-------------------PIN DEFINITIONS----------------------*/
#define ACTUATOR_ONOFF_PIN 4