1 parent
9e9a2cd191
commit
9481bcd868
2 files changed
+10
-1
No files matched your search
@@ -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
|
||||
|
||||
+9
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user