diff --git a/ZactuatorONOFF.ino b/ZactuatorONOFF.ino index bedbf05..b4324c5 100644 --- a/ZactuatorONOFF.ino +++ b/ZactuatorONOFF.ino @@ -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 diff --git a/config_ONOFF.h b/config_ONOFF.h index 3db2cc0..111f1cb 100644 --- a/config_ONOFF.h +++ b/config_ONOFF.h @@ -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