diff --git a/User_config.h b/User_config.h index 6f30040..5a9f2e2 100644 --- a/User_config.h +++ b/User_config.h @@ -105,6 +105,7 @@ RF supported protocols #define subjectMQTTtoIR "home/commands/MQTTtoIR" #define subjectIRtoMQTTprotocol "home/IRtoMQTT/protocol" #define subjectIRtoMQTTbits "home/IRtoMQTT/bits" +#define subjectIRtoMQTTRaw "home/IRtoMQTT/raw" // subject monitored to listen traffic processed by other gateways to store data and avoid ntuple #define subjectMultiGTWIR "+/IRtoMQTT" #define IRbitsKey "IRBITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits diff --git a/ZgatewayIR.ino b/ZgatewayIR.ino index 7431c1f..9e250e8 100644 --- a/ZgatewayIR.ino +++ b/ZgatewayIR.ino @@ -58,13 +58,21 @@ boolean IRtoMQTT(){ MQTTvalue = results.value; MQTTprotocol = String(results.decode_type); MQTTbits = String(results.bits); + String rawCode = ""; + // Dump data + for (int i = 1; i < results.rawlen; i++) { + rawCode = rawCode + (results.rawbuf[i] * USECPERTICK); + if ( i < results.rawlen-1 ) rawCode = rawCode + ","; // ',' not needed on last one + } + trc(rawCode); irrecv.resume(); // Receive the next value if (pubIRunknownPrtcl == false && MQTTprotocol == "-1"){ // don't publish unknown IR protocol trc(F("--------------don't publish the received code unknown protocol--------------")); } else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT trc(F("Sending adv data to MQTT")); client.publish(subjectIRtoMQTTprotocol,(char *)MQTTprotocol.c_str()); - client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str()); + client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str()); + client.publish(subjectIRtoMQTTRaw,(char *)rawCode.c_str()); trc(F("Sending IR to MQTT")); String value = String(MQTTvalue); trc(value);