add send panasonic IR and send MM

#53
sendPanasonic for arduino & ESP8266
sendRCMM for ESP8266
some trace reductions
This commit is contained in:
1technophile committed 2017-06-06 21:32:14 +02:00
1 parent 7382e19f67
commit be7a876dfd
3 files changed
+28 -11

No files matched your search

+17 -4
View File
@@ -67,9 +67,9 @@ boolean IRtoMQTT(){
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 code unknown protocol---"));
trc(F("---no publish unknown protocol---"));
} else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT
trc(F("Sending adv data to MQTT"));
trc(F("Adv data IRtoMQTT"));
client.publish(subjectIRtoMQTTprotocol,(char *)MQTTprotocol.c_str());
client.publish(subjectIRtoMQTTbits,(char *)MQTTbits.c_str());
client.publish(subjectIRtoMQTTRaw,(char *)rawCode.c_str());
@@ -78,7 +78,7 @@ boolean IRtoMQTT(){
trc(value);
boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str());
if (repeatIRwMQTT){
trc(F("Publishing IR so as to repeat it"));
trc(F("Publishing IR for repeat"));
client.publish(subjectMQTTtoIR,(char *)value.c_str());
}
return result;
@@ -238,10 +238,23 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
signalSent = true;
}
#endif
#ifdef IR_PANASONIC
if (strstr(topicOri, "IR_PANASONIC") != NULL){
irsend.sendPanasonic(PanasonicAddress, data);
signalSent = true;
}
#endif
#ifdef IR_RCMM
if (strstr(topicOri, "IR_RCMM") != NULL){
if (valueBITS == 0) valueBITS = 32;
irsend.sendRCMM(data, valueBITS);
signalSent = true;
}
#endif
if (signalSent){ // we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
if (result){
trc(F("Signal sent by IR ack published"));
trc(F("MQTTtoIR OK ack published"));
trc(String(data));
};
}