Update ESP IR library & IR gateway improvments (#480)

* update irremoteesp8266

* add new protocols, simplify API and publish protocol name

-added the following protocols:
  #define IR_LEGOPF
  #define IR_MITSUBISHI_HEAVY_88
  #define IR_MITSUBISHI_HEAVY_152
  #define IR_DAIKIN216
  #define IR_SHARP_AC
  #define IR_GOODWEATHER
  #define IR_INAX
  #define IR_DAIKIN160
  #define IR_NEOCLIMA
  #define IR_DAIKIN176
  #define IR_DAIKIN128
  #define IR_AMCOR
  #define IR_DAIKIN152
  #define IR_MITSUBISHI136
  #define IR_MITSUBISHI112
  #define IR_HITACHI_AC424
-changed the send API, now you can use the protocol name directly exemple NEC instead of IR_NEC
-publish the protocol name to MQTT added to the number
-replace long by long long

* missing repeat definitions

and set default repeat value to 0

* move protocol name retrieving outside arduino scope

* put all protocols with capital letters

* modify doc

* add long long activation for arduino json on test_config file
This commit is contained in:
Florian authored and GitHub committed 2019-11-02 12:49:05 +01:00
1 parent 82c9b7ce55
commit 3a4ccdcc9f
6 files changed
+256 -134

No files matched your search

+5 -31
View File
@@ -11,16 +11,11 @@ Subscribe to all the messages with mosquitto or open your MQTT client software:
And press your IR remote control in front of the receiver led you should see the following messages for example:
```
home/OpenMQTTGateway/IRtoMQTT {"value":875849879,"protocol":7,"bits":32,"raw":"4534,4432,612,518,614,516,616,1618,618,1616,618,512,618,1618,608,524,612,518,616,514,618,512,616,1618,616,1618,618,514,616,1618,616,514,616,514,618,512,616,1618,618,1618,618,514,610,1622,616,514,618,514,614,516,616,1618,618,512,618,512,618,1616,550,580,618,1616,612,1624,618,1616,618"}
home/OpenMQTTGateway/IRtoMQTT {"value":875849879,"protocol":7,"protocol_name":SAMSUNG,"bits":32,"raw":"4534,4432,612,518,614,516,616,1618,618,1616,618,512,618,1618,608,524,612,518,616,514,618,512,616,1618,616,1618,618,514,616,1618,616,514,616,514,618,512,616,1618,618,1618,618,514,610,1622,616,514,618,514,614,516,616,1618,618,512,618,512,618,1616,550,580,618,1616,612,1624,618,1616,618"}
```
To receive big dump of raw data you need first to modify the [config_IR.h](https://github.com/1technophile/OpenMQTTGateway/blob/091b317660fd201a30e2cd0e15424a13c5a6bd71/config_IR.h#L41) and uncomment DumpMode true
To know the name of the protocol corresponding to the number X (X=7 in our case), go to IRRemote header file definition and go to the protocol number X, RC5 = 1, RC6 = 2...
[For ESP8266](https://github.com/markszabo/IRremoteESP8266/blob/master/src/IRremoteESP8266.h)
[For Arduino](https://github.com/z3t0/Arduino-IRremote/blob/master/IRremote.h)
For number 7 it is samsung protocol
Unknown protocols are filtered by default, if you want to see the unknown protocols set into [config_IR.h](https://github.com/1technophile/OpenMQTTGateway/blob/master/config_IR.h)
`#define pubIRunknownPrtcl true` instead of false
@@ -29,38 +24,17 @@ Unknown protocols are filtered by default, if you want to see the unknown protoc
You can take this code and try to reproduce it with the gateway either by using [decimal value](#send-data-by-mqtt-to-convert-it-on-ir-signal) or the [raw value](#send-raw-ir-data-by-mqtt).
## Send data by MQTT to convert it on IR signal
With the IR gateway you need to put on the topic the protocol you want to use to send the signal, the different protocols implemented are the following, the MQTT keyword to include is between "":
* IR_GC
* IR_Sony
* IR_COOLIX
* IR_Whynter
* IR_NEC
* IR_DISH
* IR_Sharp
* IR_SAMSUNG
* IR_RC5
* IR_RC6 (ESP8266 only)
* IR_MITSUBISHI (ESP8266 only)
* IR_GICABLE (ESP8266 only)
* IR_MITSUBISHI2 (ESP8266 only)
* IR_LASERTAG (ESP8266 only)
* IR_CARRIER_AC (ESP8266 only)
* IR_MIDEA (ESP8266 only)
* IR_NIKAI (ESP8266 only)
* IR_SHERWOOD (ESP8266 only)
* IR_DENON (ESP8266 only)
* IR_AIWA_RC_T501 (ESP8266 only)
* IR_JVC (ESP8266 only)
With the IR gateway you need to put on the topic the protocol_name you want to use to send the signal, the different protocols implemented are [here](https://github.com/crankyoldgit/IRremoteESP8266/blob/f9d7e5c622670132731e3f9c64d9132128eb320c/src/IRremoteESP8266.h#L299)
Exhaustive list [here](https://docs.google.com/spreadsheets/d/1_5fQjAixzRtepkykmL-3uN3G5bLfQ0zMajM9OBZ1bx0/edit#gid=1910001295)
For example if I want to send a command to a sony TV you can use the following command:
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"value":551489775,"protocol_name":"IR_Sony "}'`
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"value":551489775,"protocol_name":"SONY"}'`
The code after the -m represent the payload you want to send.
If you don’t want to use special parameters for IR just use value key, the protocol per default is IR_NEC
If you don’t want to use special parameters for IR just use value key, the protocol per default is NEC
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"value":551489775}'`
@@ -101,7 +75,7 @@ IR sending support two advanced parameters; bits length and repeat number.
The example below will send the following advanced parameters bits: 14 and repeat:4 times for a sony protocol:
```
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"value":551489775,"protocol_name":"IR_NEC","repeat":4,"bits":14}'
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"value":551489775,"protocol_name":"NEC","repeat":4,"bits":14}'
```
## Send raw IR data by MQTT
+1
View File
@@ -190,6 +190,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#define ARDUINOJSON_USE_LONG_LONG 1
#else // boards with smaller memory
#define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#endif
+226 -96
View File
@@ -110,6 +110,7 @@ void IRtoMQTT(){
#if defined(ESP8266) || defined(ESP32) //resultToHexidecimal is only available with IRremoteESP8266
String hex = resultToHexidecimal(&results);
IRdata.set("hex", (char *)hex.c_str());
IRdata.set("protocol_name", (char *)(typeToString(results.decode_type,false)).c_str());
#endif
String rawCode = "";
// Dump data
@@ -140,9 +141,10 @@ void IRtoMQTT(){
trc(F("raw redirected"));
#endif
irrecv.resume(); // Receive the next value
unsigned long MQTTvalue = IRdata.get<unsigned long>("value");
if (pubIRunknownPrtcl == false && IRdata.get<int>("protocol") == -1){ // don't publish unknown IR protocol
trc(F("--no pub unknown prt--"));
unsigned long MQTTvalue = IRdata.get<unsigned long long>("value");
trc(MQTTvalue);
if ((pubIRunknownPrtcl == false && IRdata.get<int>("protocol") == -1 )/*|| MQTTvalue == ULONG_MAX*/){ // don't publish unknown IR protocol or data to high
trc(F("--no pub unknwn prt or data to high--"));
} else if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of IR -->MQTT
trc(F("Adv data IRtoMQTT"));
pub(subjectIRtoMQTT,IRdata);
@@ -178,8 +180,8 @@ void IRtoMQTT(){
data = strtoul(datacallback, NULL, 10); // standard sending with unsigned long, we will not be able to pass values > 4294967295
}
#ifdef IR_GC
else if(strstr(topicOri, "IR_GC") != NULL){ // sending GC data from https://irdb.globalcache.com
trc(F("IR_GC"));
else if(strstr(topicOri, "GC") != NULL){ // sending GC data from https://irdb.globalcache.com
trc(F("GC"));
//buffer allocation from char datacallback
uint16_t GC[count+1];
String value = "";
@@ -200,9 +202,9 @@ void IRtoMQTT(){
signalSent = true;
}
#endif
#ifdef IR_Raw
else if(strstr(topicOri, "IR_Raw") != NULL){ // sending Raw data
trc(F("IR_Raw"));
#ifdef IR_RAW
else if(strstr(topicOri, "Raw") != NULL){ // sending Raw data
trc(F("Raw"));
//buffer allocation from char datacallback
#if defined(ESP8266) || defined(ESP32)
uint16_t Raw[count+1];
@@ -248,10 +250,11 @@ void IRtoMQTT(){
trc(valueRPT);
}
if(topicOri && (strstr(topicOri, "IR_NEC") == NULL)){
if(topicOri && (strstr(topicOri, "NEC") == NULL)){
trc("SendId prt");
signalSent = sendIdentifiedProtocol(topicOri, data, datacallback, valueBITS, valueRPT);
}else{
trc(F("Using NEC protocol"));
trc(F("Not identified prt using NEC"));
if (valueBITS == 0) valueBITS = NEC_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendNEC(data, valueBITS, valueRPT);
@@ -273,14 +276,12 @@ void IRtoMQTT(){
if (strcmp(topicOri,subjectMQTTtoIR) == 0){
trc(F("MQTTtoIR json"));
unsigned long data = IRdata["value"];
uint64_t data = IRdata["value"];
const char * raw = IRdata["raw"];
const char * datastring = IRdata["datastring"];
if (data != 0 || raw || datastring) {
trc(F("MQTTtoIR value || raw || datasring ok"));
bool signalSent = false;
trc(F("value"));
trc(data);
if(datastring){
trc(F("datastring"));
trc(datastring);
@@ -304,8 +305,8 @@ void IRtoMQTT(){
}
}
#ifdef IR_GC
if(strstr(protocol_name, "IR_GC") != NULL){ // sending GC data from https://irdb.globalcache.com
trc(F("IR_GC"));
if(strstr(protocol_name, "GC") != NULL){ // sending GC data from https://irdb.globalcache.com
trc(F("GC"));
//buffer allocation from char datacallback
uint16_t GC[count+1];
String value = "";
@@ -326,9 +327,9 @@ void IRtoMQTT(){
signalSent = true;
}
#endif
#ifdef IR_Raw
if(strstr(protocol_name, "IR_Raw") != NULL){ // sending Raw data
trc(F("IR_Raw"));
#ifdef IR_RAW
if(strstr(protocol_name, "Raw") != NULL){ // sending Raw data
trc(F("Raw"));
//buffer allocation from char datacallback
#if defined(ESP8266) || defined(ESP32)
uint16_t Raw[count+1];
@@ -353,7 +354,7 @@ void IRtoMQTT(){
signalSent = true;
}
#endif
}else if(protocol_name && (strstr(protocol_name, "IR_NEC") == NULL)){
}else if(protocol_name && (strstr(protocol_name, "NEC") == NULL)){
signalSent = sendIdentifiedProtocol(protocol_name, data, datastring, valueBITS, valueRPT);
}else{
trc(F("Using NEC protocol"));
@@ -377,7 +378,7 @@ void IRtoMQTT(){
}
#endif
bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, const char * datastring, unsigned int valueBITS, uint16_t valueRPT){
bool sendIdentifiedProtocol(const char * protocol_name, unsigned long long data, const char * datastring, unsigned int valueBITS, uint16_t valueRPT){
unsigned char dataarray[valueBITS];
const char* pointer = datastring;
int i = 0;
@@ -392,8 +393,8 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
}
#ifdef IR_Whynter
if (strstr(protocol_name, "IR_Whynter") != NULL){
#ifdef IR_WHYNTER
if (strstr(protocol_name, "WHYNTER") != NULL){
if (valueBITS == 0) valueBITS = WHYNTER_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendWhynter(data, valueBITS, valueRPT);
@@ -404,7 +405,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_LG
if (strstr(protocol_name, "IR_LG") != NULL){
if (strstr(protocol_name, "LG") != NULL){
if (valueBITS == 0) valueBITS = LG_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendLG(data, valueBITS, valueRPT);
@@ -414,8 +415,8 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
return true;
}
#endif
#ifdef IR_Sony
if (strstr(protocol_name, "IR_Sony") != NULL){
#ifdef IR_SONY
if (strstr(protocol_name, "SONY") != NULL){
if (valueBITS == 0) valueBITS = SONY_12_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendSony(data, valueBITS, valueRPT);
@@ -426,7 +427,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_DISH
if (strstr(protocol_name, "IR_DISH") != NULL){
if (strstr(protocol_name, "DISH") != NULL){
if (valueBITS == 0) valueBITS = DISH_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendDISH(data, valueBITS, valueRPT);
@@ -437,7 +438,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_RC5
if (strstr(protocol_name, "IR_RC5") != NULL){
if (strstr(protocol_name, "RC5") != NULL){
if (valueBITS == 0) valueBITS = RC5_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendRC5(data, valueBITS, valueRPT);
@@ -448,7 +449,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_RC6
if (strstr(protocol_name, "IR_RC6") != NULL){
if (strstr(protocol_name, "RC6") != NULL){
if (valueBITS == 0) valueBITS = RC6_MODE0_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendRC6(data, valueBITS, valueRPT);
@@ -458,8 +459,8 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
return true;
}
#endif
#ifdef IR_Sharp
if (strstr(protocol_name, "IR_Sharp") != NULL){
#ifdef IR_SHARP
if (strstr(protocol_name, "SHARP") != NULL){
if (valueBITS == 0) valueBITS = SHARP_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendSharpRaw(data, valueBITS, valueRPT);
@@ -470,7 +471,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_SAMSUNG
if (strstr(protocol_name, "IR_SAMSUNG") != NULL){
if (strstr(protocol_name, "SAMSUNG") != NULL){
if (valueBITS == 0) valueBITS = SAMSUNG_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendSAMSUNG(data, valueBITS, valueRPT);
@@ -481,7 +482,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_JVC
if (strstr(protocol_name, "IR_JVC") != NULL){
if (strstr(protocol_name, "JVC") != NULL){
if (valueBITS == 0) valueBITS = JVC_BITS;
#if defined(ESP8266) || defined(ESP32)
irsend.sendJVC(data, valueBITS, valueRPT);
@@ -492,7 +493,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_PANASONIC
if (strstr(protocol_name, "IR_PANASONIC") != NULL){
if (strstr(protocol_name, "PANASONIC") != NULL){
#if defined(ESP8266) || defined(ESP32)
if (valueBITS == 0) valueBITS = PANASONIC_BITS;
irsend.sendPanasonic(PanasonicAddress, data, valueBITS, valueRPT);
@@ -505,28 +506,29 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
#if defined(ESP8266) || defined(ESP32) // sendings not available on arduino
#ifdef IR_COOLIX
if (strstr(protocol_name, "IR_COOLIX") != NULL){
if (strstr(protocol_name, "COOLIX") != NULL){
if (valueBITS == 0) valueBITS = kCoolixBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kCoolixDefaultRepeat);
irsend.sendCOOLIX(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_RCMM
if (strstr(protocol_name, "IR_RCMM") != NULL){
if (strstr(protocol_name, "RCMM") != NULL){
if (valueBITS == 0) valueBITS = kRCMMBits;
irsend.sendRCMM(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DENON
if (strstr(protocol_name, "IR_DENON") != NULL){
if (strstr(protocol_name, "DENON") != NULL){
if (valueBITS == 0) valueBITS = DENON_BITS;
irsend.sendDenon(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_GICABLE
if (strstr(protocol_name, "IR_GICABLE") != NULL){
if (strstr(protocol_name, "GICABLE") != NULL){
if (valueBITS == 0) valueBITS = kGicableBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kGicableMinRepeat);
irsend.sendGICable(data, valueBITS, valueRPT);
@@ -534,7 +536,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_SHERWOOD
if (strstr(protocol_name, "IR_SHERWOOD") != NULL){
if (strstr(protocol_name, "SHERWOOD") != NULL){
if (valueBITS == 0) valueBITS = kSherwoodBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kSherwoodMinRepeat);
irsend.sendSherwood(data, valueBITS, valueRPT);
@@ -542,7 +544,7 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_MITSUBISHI
if (strstr(protocol_name, "IR_MITSUBISHI") != NULL){
if (strstr(protocol_name, "MITSUBISHI") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishiBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishiMinRepeat);
irsend.sendMitsubishi(data, valueBITS, valueRPT);
@@ -550,42 +552,45 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_NIKAI
if (strstr(protocol_name, "IR_NIKAI") != NULL){
if (strstr(protocol_name, "NIKAI") != NULL){
if (valueBITS == 0) valueBITS = kNikaiBits;
irsend.sendNikai(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MIDEA
if (strstr(protocol_name, "IR_MIDEA") != NULL){
if (strstr(protocol_name, "MIDEA") != NULL){
if (valueBITS == 0) valueBITS = kMideaBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMideaMinRepeat);
irsend.sendMidea(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MAGIQUEST
if (strstr(protocol_name, "IR_MAGIQUEST") != NULL){
if (strstr(protocol_name, "MAGIQUEST") != NULL){
if (valueBITS == 0) valueBITS = kMagiquestBits;
irsend.sendMagiQuest(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_LASERTAG
if (strstr(protocol_name, "IR_LASERTAG") != NULL){
if (strstr(protocol_name, "LASERTAG") != NULL){
if (valueBITS == 0) valueBITS = kLasertagBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kLasertagMinRepeat);
irsend.sendLasertag(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_CARRIER_AC
if (strstr(protocol_name, "IR_CARRIER_AC") != NULL){
if (strstr(protocol_name, "CARRIER_AC") != NULL){
if (valueBITS == 0) valueBITS = kCarrierAcBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kCarrierAcMinRepeat);
irsend.sendCarrierAC(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHI2
if (strstr(protocol_name, "IR_MITSUBISHI2") != NULL){
if (strstr(protocol_name, "MITSUBISHI2") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishiBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishiMinRepeat);
irsend.sendMitsubishi2(data, valueBITS, valueRPT);
@@ -593,221 +598,346 @@ bool sendIdentifiedProtocol(const char * protocol_name, unsigned long data, cons
}
#endif
#ifdef IR_AIWA_RC_T501
if (strstr(protocol_name, "IR_AIWA_RC_T501") != NULL){
if (strstr(protocol_name, "AIWA_RC_T501") != NULL){
if (valueBITS == 0) valueBITS = kAiwaRcT501Bits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kAiwaRcT501MinRepeats);
irsend.sendAiwaRCT501(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_SANYO
if (strstr(protocol_name, "IR_SANYO") != NULL){
if (valueBITS == 0) valueBITS = kSanyoLC7461Bits;
irsend.sendSanyoLC7461(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN
if (strstr(protocol_name, "IR_DAIKIN") != NULL){
if (strstr(protocol_name, "DAIKIN") != NULL){
if (valueBITS == 0) valueBITS = kDaikinStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikinDefaultRepeat);
irsend.sendDaikin(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_KELVINATOR
if (strstr(protocol_name, "IR_KELVINATOR") != NULL){
if (strstr(protocol_name, "KELVINATOR") != NULL){
if (valueBITS == 0) valueBITS = kKelvinatorStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kKelvinatorDefaultRepeat);
irsend.sendKelvinator(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHI_AC
if (strstr(protocol_name, "IR_MITSUBISHI_AC") != NULL){
if (strstr(protocol_name, "MITSUBISHI_AC") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishiACStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishiACMinRepeat);
irsend.sendMitsubishiAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_SANYO
if (strstr(protocol_name, "IR_SANYO") != NULL){
if (strstr(protocol_name, "SANYOLC7461") != NULL){
if (valueBITS == 0) valueBITS = kSanyoLC7461Bits;
irsend.sendSanyoLC7461(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_GREE
if (strstr(protocol_name, "IR_GREE") != NULL){
if (strstr(protocol_name, "GREE") != NULL){
if (valueBITS == 0) valueBITS = kGreeStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kGreeDefaultRepeat);
irsend.sendGree(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_ARGO
if (strstr(protocol_name, "IR_ARGO") != NULL){
if (strstr(protocol_name, "ARGO") != NULL){
if (valueBITS == 0) valueBITS = kArgoStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kArgoDefaultRepeat);
irsend.sendArgo(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_TROTEC
if (strstr(protocol_name, "IR_TROTEC") != NULL){
if (strstr(protocol_name, "TROTEC") != NULL){
if (valueBITS == 0) valueBITS = kTrotecStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kTrotecDefaultRepeat);
irsend.sendTrotec(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_TOSHIBA_AC
if (strstr(protocol_name, "IR_TOSHIBA_AC") != NULL){
if (strstr(protocol_name, "TOSHIBA_AC") != NULL){
if (valueBITS == 0) valueBITS = kToshibaACBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kToshibaACMinRepeat);
irsend.sendToshibaAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_FUJITSU_AC
if (strstr(protocol_name, "IR_FUJITSU_AC") != NULL){
if (strstr(protocol_name, "FUJITSU_AC") != NULL){
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kFujitsuAcMinRepeat);
irsend.sendFujitsuAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MAGIQUEST
if (strstr(protocol_name, "IR_MAGIQUEST") != NULL){
if (valueBITS == 0) valueBITS = kMagiquestBits;
irsend.sendMagiQuest(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HAIER_AC
if (strstr(protocol_name, "IR_HAIER_AC") != NULL){
if (strstr(protocol_name, "HAIER_AC") != NULL){
if (valueBITS == 0) valueBITS = kHaierACStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHaierAcDefaultRepeat);
irsend.sendHaierAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HITACHI_AC
if (strstr(protocol_name, "IR_HITACHI_AC") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAc2StateLength;
if (strstr(protocol_name, "HITACHI_AC") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHitachiAcDefaultRepeat);
irsend.sendHitachiAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HITACHI_AC1
if (strstr(protocol_name, "IR_HITACHI_AC1") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAc2StateLength;
if (strstr(protocol_name, "HITACHI_AC1") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAc1StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHitachiAcDefaultRepeat);
irsend.sendHitachiAC1(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HITACHI_AC2
if (strstr(protocol_name, "IR_HITACHI_AC2") != NULL){
if (strstr(protocol_name, "HITACHI_AC2") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAc2StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHitachiAcDefaultRepeat);
irsend.sendHitachiAC2(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_GICABLE
if (strstr(protocol_name, "IR_GICABLE") != NULL){
if (valueBITS == 0) valueBITS = kGicableBits;
irsend.sendGICable(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HAIER_AC_YRW02
if (strstr(protocol_name, "IR_HAIER_AC_YRW02") != NULL){
if (strstr(protocol_name, "HAIER_AC_YRW02") != NULL){
if (valueBITS == 0) valueBITS = kHaierACYRW02StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHaierAcYrw02DefaultRepeat);
irsend.sendHaierACYRW02(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_WHIRLPOOL_AC
if (strstr(protocol_name, "IR_WHIRLPOOL_AC") != NULL){
if (strstr(protocol_name, "WHIRLPOOL_AC") != NULL){
if (valueBITS == 0) valueBITS = kWhirlpoolAcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kWhirlpoolAcDefaultRepeat);
irsend.sendWhirlpoolAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_SAMSUNG_AC
if (strstr(protocol_name, "IR_SAMSUNG_AC") != NULL){
if (strstr(protocol_name, "SAMSUNG_AC") != NULL){
if (valueBITS == 0) valueBITS = kSamsungAcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kSamsungAcDefaultRepeat);
irsend.sendSamsungAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_LUTRON
if (strstr(protocol_name, "IR_LUTRON") != NULL){
if (strstr(protocol_name, "LUTRON") != NULL){
if (valueBITS == 0) valueBITS = kLutronBits;
irsend.sendLutron(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_ELECTRA_AC
if (strstr(protocol_name, "IR_ELECTRA_AC") != NULL){
if (strstr(protocol_name, "ELECTRA_AC") != NULL){
if (valueBITS == 0) valueBITS = kElectraAcStateLength;
irsend.sendElectraAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_PANASONIC_AC
if (strstr(protocol_name, "IR_PANASONIC_AC") != NULL){
if (strstr(protocol_name, "PANASONIC_AC") != NULL){
if (valueBITS == 0) valueBITS = kPanasonicAcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kPanasonicAcDefaultRepeat);
irsend.sendPanasonicAC(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_PIONEER
if (strstr(protocol_name, "IR_PIONEER") != NULL){
if (strstr(protocol_name, "PIONEER") != NULL){
if (valueBITS == 0) valueBITS = kPioneerBits;
irsend.sendPioneer(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_LG2
if (strstr(protocol_name, "IR_LG2") != NULL){
if (strstr(protocol_name, "LG2") != NULL){
if (valueBITS == 0) valueBITS = kLgBits;
irsend.sendLG2(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MWM
if (strstr(protocol_name, "IR_MWM") != NULL){
if (strstr(protocol_name, "MWM") != NULL){
irsend.sendMWM(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN2
if (strstr(protocol_name, "IR_DAIKIN2") != NULL){
if (strstr(protocol_name, "DAIKIN2") != NULL){
if (valueBITS == 0) valueBITS = kDaikin2StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin2DefaultRepeat);
irsend.sendDaikin2(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_VESTEL_AC
if (strstr(protocol_name, "IR_VESTEL_AC") != NULL){
if (strstr(protocol_name, "VESTEL_AC") != NULL){
if (valueBITS == 0) valueBITS = kVestelAcBits;
irsend.sendVestelAc(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_SAMSUNG36
if (strstr(protocol_name, "IR_SAMSUNG36") != NULL){
if (strstr(protocol_name, "SAMSUNG36") != NULL){
if (valueBITS == 0) valueBITS = kSamsung36Bits;
irsend.sendSamsung36(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_TCL112AC
if (strstr(protocol_name, "IR_TCL112AC") != NULL){
if (strstr(protocol_name, "TCL112AC") != NULL){
if (valueBITS == 0) valueBITS = kTcl112AcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kTcl112AcDefaultRepeat);
irsend.sendTcl112Ac(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_TECO
if (strstr(protocol_name, "IR_TECO") != NULL){
if (strstr(protocol_name, "TECO") != NULL){
if (valueBITS == 0) valueBITS = kTecoBits;
irsend.sendTeco(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_LEGOPF
if (strstr(protocol_name, "LEGOPF") != NULL){
if (valueBITS == 0) valueBITS = kLegoPfBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kLegoPfMinRepeat);
irsend.sendLegoPf(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHIHEAVY88
if (strstr(protocol_name, "MITSUBISHIHEAVY88") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishiHeavy88StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishiHeavy88MinRepeat);
irsend.sendMitsubishiHeavy88(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHIHEAVY152
if (strstr(protocol_name, "MITSUBISHIHEAVY152") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishiHeavy152StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishiHeavy152MinRepeat);
irsend.sendMitsubishiHeavy152(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN216
if (strstr(protocol_name, "DAIKIN216") != NULL){
if (valueBITS == 0) valueBITS = kDaikin216StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin216DefaultRepeat);
irsend.sendDaikin216(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_SHARP_AC
if (strstr(protocol_name, "SHARP_AC") != NULL){
if (valueBITS == 0) valueBITS = kSharpAcStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kSharpAcDefaultRepeat);
irsend.sendSharpAc(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_GOODWEATHER
if (strstr(protocol_name, "GOODWEATHER_AC") != NULL){
if (valueBITS == 0) valueBITS = kGoodweatherBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kGoodweatherMinRepeat);
irsend.sendGoodweather(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_INAX
if (strstr(protocol_name, "INAX") != NULL){
if (valueBITS == 0) valueBITS = kInaxBits;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kInaxMinRepeat);
irsend.sendInax(data, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN160
if (strstr(protocol_name, "DAIKIN160") != NULL){
if (valueBITS == 0) valueBITS = kDaikin160StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin160DefaultRepeat);
irsend.sendDaikin160(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_NEOCLIMA
if (strstr(protocol_name, "NEOCLIMA") != NULL){
if (valueBITS == 0) valueBITS = kNeoclimaStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kNeoclimaMinRepeat);
irsend.sendNeoclima(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN176
if (strstr(protocol_name, "DAIKIN176") != NULL){
if (valueBITS == 0) valueBITS = kDaikin176StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin176DefaultRepeat);
irsend.sendDaikin176(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN128
if (strstr(protocol_name, "DAIKIN128") != NULL){
if (valueBITS == 0) valueBITS = kDaikin128StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin128DefaultRepeat);
irsend.sendDaikin128(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_AMCOR
if (strstr(protocol_name, "AMCOR") != NULL){
if (valueBITS == 0) valueBITS = kAmcorStateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kAmcorDefaultRepeat);
irsend.sendAmcor(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_DAIKIN152
if (strstr(protocol_name, "DAIKIN152") != NULL){
if (valueBITS == 0) valueBITS = kDaikin152StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kDaikin152DefaultRepeat);
irsend.sendDaikin152(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHI136
if (strstr(protocol_name, "MITSUBISHI136") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishi136StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishi136MinRepeat);
irsend.sendMitsubishi136(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_MITSUBISHI112
if (strstr(protocol_name, "MITSUBISHI112") != NULL){
if (valueBITS == 0) valueBITS = kMitsubishi112StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kMitsubishi112MinRepeat);
irsend.sendMitsubishi112(dataarray, valueBITS, valueRPT);
return true;
}
#endif
#ifdef IR_HITACHI_AC424
if (strstr(protocol_name, "HITACHI_AC424") != NULL){
if (valueBITS == 0) valueBITS = kHitachiAc424StateLength;
if (valueRPT == repeatIRwNumber) valueRPT = std::max(valueRPT, kHitachiAcDefaultRepeat);
irsend.sendHitachiAc424(dataarray, valueBITS, valueRPT);
return true;
}
#endif
return false;
#endif
}
+22 -6
View File
@@ -41,8 +41,8 @@ extern void MQTTtoIR(char * topicOri, JsonObject& RFdata);
#define IRbitsKey "IRBITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits
#define IRRptKey "RPT_" // repeats will be defined if a subject contains IRRptKey followed by a value of 1 digit
#define repeatIRwMQTT false // do we repeat a received signal by using mqtt
#define repeatIRwNumber 3 // default repeat of the signal
#define RawDirectForward false // direct repeat of IR signal with raw data
#define repeatIRwNumber 0 // default repeat of the signal
//#define RawDirectForward false // direct repeat of IR signal with raw data
#define RawFrequency 38 // raw frequency sending
//#define DumpMode true // uncomment so as to see big dumps of IR codes
@@ -51,15 +51,15 @@ extern void MQTTtoIR(char * topicOri, JsonObject& RFdata);
#if defined(ESP8266) || defined(ESP32) //IR supported protocols on ESP8266, all supported per default
#define IR_GC
#define IR_Raw
#define IR_RAW
#define IR_COOLIX
#define IR_Whynter
#define IR_WHYNTER
#define IR_LG
#define IR_Sony
#define IR_SONY
#define IR_DISH
#define IR_RC5
#define IR_RC6
#define IR_Sharp
#define IR_SHARP
#define IR_SAMSUNG
#define IR_PANASONIC
#define IR_RCMM
@@ -104,6 +104,22 @@ extern void MQTTtoIR(char * topicOri, JsonObject& RFdata);
#define IR_SAMSUNG36
#define IR_TCL112AC
#define IR_TECO
#define IR_LEGOPF
#define IR_MITSUBISHI_HEAVY_88
#define IR_MITSUBISHI_HEAVY_152
#define IR_DAIKIN216
#define IR_SHARP_AC
#define IR_GOODWEATHER
#define IR_INAX
#define IR_DAIKIN160
#define IR_NEOCLIMA
#define IR_DAIKIN176
#define IR_DAIKIN128
#define IR_AMCOR
#define IR_DAIKIN152
#define IR_MITSUBISHI136
#define IR_MITSUBISHI112
#define IR_HITACHI_AC424
#elif __AVR_ATmega2560__
#define IR_COOLIX
#define IR_Whynter
+1 -1
View File
@@ -60,7 +60,7 @@ pubsubclient = PubSubClient@2.7
rc-switch = 1technophile/rc-switch#90adb34
newremoteswitch = 1technophile/NewRemoteSwitch#8eb980e
ble = eos1d3/ESP32_BLE#9d6c1ed
irremoteesp = IRremoteESP8266@2.6.3
irremoteesp = IRremoteESP8266@2.7.0
irremote = IRremote
lora = sandeepmistry/arduino-LoRa#f4a1d27
esppilight = ESPiLight@0.16.2
+1
View File
@@ -154,6 +154,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#endif
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define JSON_MSG_BUFFER 1024 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#define ARDUINOJSON_USE_LONG_LONG 1
#else // boards with smaller memory
#define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#endif