2.5.3
Background:
I'm new to coding IR stuff, but I've been a hobby programmer for many years. I've been toying with esp8266 and arduinos for about a year.
I rent an apartment with an older AC/heat pump unit, the brand is NEX, but I can't find any info about the brand online. I'm trying to make a little wifi-connected remote to control this unit.
I uploaded the IRrecvDumpV2 program to a nodeMCU board with an IR receiver diode connected. The program recognized the remote control codes as the Coolix type/protocol, and the codes read from the remote seem to closely match the Coolix codes.
However, when I try to use the library to send codes to my unit, nothing happens. I've tried many variations, with no luck.
First I tried variations of this sequence:
ac.begin();
ac.setPower(true);
ac.setTemp(20);
ac.setMode(kCoolixHeat);
ac.setFan(kCoolixFanAuto);
ac.send();
No luck.
I also tried things like irsend.sendCOOLIX(0xB2BF2C); (B2BF2C is a code read from the remote control with the IRrecvDumpV2 program.)
No luck.
(Btw, looking at the diode with cell phone camera I can see the diode lighting up, so something is being sent.)
BUT! When I send the rawData captured from the remote it works perfectly! The unit turns on/off just as expected!
So there has to be a way to make this work, hopefully without capturing/sending rawData for all combinations of settings. With 5 modes, 14 different temperatures and 4 different fan settings it'll be rather inconvenient to only deal with rawData... Probably doable, but I'd rather use this nice library!
I suspect my unit uses a slightly different version of the Coolix protocol? Or there is some data sent by my remote that isn't captured by IRrecvDumpV2? I've tried playing around with the kTimeout and kMinUnknownSize values, but no change in what IRrecvDumpV2 outputs.
My unit only lets me select Auto fan speed when the mode is Auto or Dry. I discovered that in those cases the library doesn't recognize the Auto fan speed. See output further down.
Also note that the power off command in the library (0xB27BE0) matches what is read from my remote, but sending the code still doesn't work.
Power off command:
Timestamp : 000039.489
Encoding : COOLIX
Code : B27BE0 (24 bits)
Mesg Desc.: Power: Off
Library : v2.5.3
Raw Timing[199]:
+ 4526, - 4412, + 594, - 1600, + 624, - 498, + 624, - 1568,
+ 594, - 1600, + 610, - 514, + 594, - 524, + 610, - 1556,
+ 622, - 500, + 624, - 496, + 622, - 1572, + 624, - 498,
+ 622, - 500, + 622, - 1570, + 592, - 1580, + 612, - 508,
+ 698, - 1490, + 622, - 526, + 588, - 1578, + 622, - 1570,
+ 624, - 1568, + 592, - 1576, + 614, - 532, + 676, - 1488,
+ 626, - 1568, + 624, - 1568, + 588, - 534, + 592, - 530,
+ 566, - 554, + 592, - 528, + 588, - 1582, + 702, - 442,
+ 644, - 528, + 610, - 1584, + 608, - 1560, + 618, - 1572,
+ 624, - 496, + 624, - 498, + 624, - 496, + 624, - 496,
+ 626, - 496, + 624, - 496, + 626, - 496, + 622, - 500,
+ 626, - 1566, + 626, - 1566, + 610, - 1558, + 702, - 1488,
+ 626, - 1566, + 626, - 4678, + 4540, - 4410, + 594, - 1600,
+ 626, - 496, + 626, - 1566, + 594, - 1602, + 590, - 506,
+ 702, - 446, + 590, - 1574, + 626, - 496, + 626, - 496,
+ 626, - 1566, + 624, - 496, + 624, - 498, + 626, - 1568,
+ 624, - 1568, + 610, - 512, + 610, - 1584, + 590, - 532,
+ 592, - 1600, + 590, - 1576, + 626, - 1566, + 624, - 1568,
+ 592, - 528, + 594, - 1576, + 702, - 1488, + 626, - 1568,
+ 624, - 498, + 624, - 498, + 624, - 496, + 626, - 496,
+ 624, - 1568, + 610, - 510, + 594, - 528, + 592, - 1600,
+ 610, - 1582, + 590, - 1576, + 618, - 528, + 594, - 526,
+ 610, - 512, + 594, - 528, + 594, - 528, + 610, - 510,
+ 594, - 528, + 594, - 528, + 608, - 1586, + 590, - 1576,
+ 624, - 1568, + 622, - 1570, + 594, - 1576, + 616
uint16_t rawData[199] = {4526, 4412, 594, 1600, 624, 498, 624, 1568, 594, 1600, 610, 514, 594, 524, 610, 1556, 622, 500, 624, 496, 622, 1572, 624, 498, 622, 500, 622, 1570, 592, 1580, 612, 508, 698, 1490, 622, 526, 588, 1578, 622, 1570, 624, 1568, 592, 1576, 614, 532, 676, 1488, 626, 1568, 624, 1568, 588, 534, 592, 530, 566, 554, 592, 528, 588, 1582, 702, 442, 644, 528, 610, 1584, 608, 1560, 618, 1572, 624, 496, 624, 498, 624, 496, 624, 496, 626, 496, 624, 496, 626, 496, 622, 500, 626, 1566, 626, 1566, 610, 1558, 702, 1488, 626, 1566, 626, 4678, 4540, 4410, 594, 1600, 626, 496, 626, 1566, 594, 1602, 590, 506, 702, 446, 590, 1574, 626, 496, 626, 496, 626, 1566, 624, 496, 624, 498, 626, 1568, 624, 1568, 610, 512, 610, 1584, 590, 532, 592, 1600, 590, 1576, 626, 1566, 624, 1568, 592, 528, 594, 1576, 702, 1488, 626, 1568, 624, 498, 624, 498, 624, 496, 626, 496, 624, 1568, 610, 510, 594, 528, 592, 1600, 610, 1582, 590, 1576, 618, 528, 594, 526, 610, 512, 594, 528, 594, 528, 610, 510, 594, 528, 594, 528, 608, 1586, 590, 1576, 624, 1568, 622, 1570, 594, 1576, 616}; // COOLIX B27BE0
uint64_t data = 0xB27BE0;
Power on, auto mode, 21 degrees C, auto fan speed:
Timestamp : 000125.162
Encoding : COOLIX
Code : B21F28 (24 bits)
Mesg Desc.: Power: On, Fan: 0 (UNKNOWN), Mode: 2 (AUTO), Temp: 20C, Zone Follow: Off, Sensor Temp: Ignored
Library : v2.5.3
Raw Timing[199]:
+ 4536, - 4382, + 592, - 1600, + 674, - 424, + 640, - 1550,
+ 592, - 1598, + 694, - 478, + 618, - 504, + 590, - 1580,
+ 640, - 478, + 618, - 502, + 644, - 1526, + 610, - 510,
+ 642, - 478, + 590, - 1578, + 610, - 1580, + 642, - 478,
+ 616, - 1554, + 642, - 480, + 614, - 508, + 610, - 510,
+ 642, - 1530, + 610, - 1580, + 590, - 1600, + 618, - 1552,
+ 590, - 1600, + 616, - 1554, + 640, - 1550, + 588, - 1580,
+ 590, - 530, + 640, - 478, + 620, - 500, + 644, - 458,
+ 634, - 484, + 608, - 536, + 618, - 502, + 616, - 1550,
+ 642, - 478, + 590, - 1628, + 590, - 508, + 610, - 510,
+ 642, - 478, + 614, - 1554, + 618, - 1574, + 590, - 508,
+ 610, - 1580, + 620, - 504, + 590, - 1578, + 642, - 1550,
+ 588, - 1578, + 642, - 4690, + 4568, - 4362, + 662, - 1550,
+ 642, - 458, + 638, - 1552, + 590, - 1600, + 618, - 502,
+ 670, - 502, + 644, - 1526, + 588, - 530, + 642, - 458,
+ 640, - 1550, + 610, - 510, + 642, - 478, + 618, - 1552,
+ 610, - 1580, + 636, - 484, + 614, - 1556, + 616, - 506,
+ 642, - 478, + 618, - 504, + 618, - 1552, + 640, - 1550,
+ 590, - 1578, + 618, - 1572, + 618, - 1552, + 610, - 1580,
+ 620, - 1550, + 642, - 1548, + 590, - 508, + 614, - 508,
+ 610, - 510, + 616, - 504, + 618, - 504, + 618, - 502,
+ 618, - 504, + 620, - 1550, + 590, - 530, + 616, - 1552,
+ 592, - 604, + 588, - 510, + 640, - 478, + 618, - 1550,
+ 590, - 1600, + 620, - 502, + 616, - 1552, + 640, - 478,
+ 618, - 1552, + 640, - 1550, + 590, - 1580, + 642
uint16_t rawData[199] = {4536, 4382, 592, 1600, 674, 424, 640, 1550, 592, 1598, 694, 478, 618, 504, 590, 1580, 640, 478, 618, 502, 644, 1526, 610, 510, 642, 478, 590, 1578, 610, 1580, 642, 478, 616, 1554, 642, 480, 614, 508, 610, 510, 642, 1530, 610, 1580, 590, 1600, 618, 1552, 590, 1600, 616, 1554, 640, 1550, 588, 1580, 590, 530, 640, 478, 620, 500, 644, 458, 634, 484, 608, 536, 618, 502, 616, 1550, 642, 478, 590, 1628, 590, 508, 610, 510, 642, 478, 614, 1554, 618, 1574, 590, 508, 610, 1580, 620, 504, 590, 1578, 642, 1550, 588, 1578, 642, 4690, 4568, 4362, 662, 1550, 642, 458, 638, 1552, 590, 1600, 618, 502, 670, 502, 644, 1526, 588, 530, 642, 458, 640, 1550, 610, 510, 642, 478, 618, 1552, 610, 1580, 636, 484, 614, 1556, 616, 506, 642, 478, 618, 504, 618, 1552, 640, 1550, 590, 1578, 618, 1572, 618, 1552, 610, 1580, 620, 1550, 642, 1548, 590, 508, 614, 508, 610, 510, 616, 504, 618, 504, 618, 502, 618, 504, 620, 1550, 590, 530, 616, 1552, 592, 604, 588, 510, 640, 478, 618, 1550, 590, 1600, 620, 502, 616, 1552, 640, 478, 618, 1552, 640, 1550, 590, 1580, 642}; // COOLIX B21F28
uint64_t data = 0xB21F28;
Power on, heat mode, 20C, low fan speed:
Timestamp : 000360.642
Encoding : COOLIX
Code : B29F2C (24 bits)
Mesg Desc.: Power: On, Fan: 4 (MIN), Mode: 3 (HEAT), Temp: 20C, Zone Follow: Off, Sensor Temp: Ignored
Library : v2.5.3
Raw Timing[199]:
+ 4568, - 4310, + 606, - 1600, + 674, - 446, + 612, - 1560,
+ 590, - 1598, + 676, - 446, + 588, - 508, + 674, - 1516,
+ 676, - 446, + 616, - 486, + 588, - 1598, + 676, - 446,
+ 616, - 484, + 672, - 1516, + 590, - 1576, + 616, - 504,
+ 674, - 1498, + 590, - 1600, + 674, - 446, + 592, - 508,
+ 612, - 1578, + 676, - 1494, + 614, - 1578, + 674, - 1516,
+ 676, - 1546, + 672, - 446, + 674, - 1496, + 614, - 1580,
+ 672, - 444, + 674, - 450, + 566, - 530, + 614, - 504,
+ 676, - 424, + 610, - 534, + 674, - 426, + 610, - 1578,
+ 676, - 444, + 612, - 1558, + 670, - 1518, + 674, - 426,
+ 590, - 528, + 676, - 1516, + 618, - 1578, + 646, - 448,
+ 702, - 1492, + 566, - 534, + 658, - 486, + 612, - 1578,
+ 702, - 1470, + 612, - 4688, + 4580, - 4352, + 696, - 1496,
+ 672, - 446, + 676, - 1498, + 588, - 1598, + 674, - 448,
+ 674, - 448, + 648, - 1518, + 610, - 488, + 636, - 488,
+ 610, - 1578, + 674, - 450, + 566, - 530, + 674, - 1514,
+ 674, - 1494, + 674, - 448, + 592, - 1576, + 676, - 1516,
+ 674, - 448, + 590, - 506, + 672, - 1520, + 702, - 1468,
+ 610, - 1558, + 638, - 1554, + 612, - 1576, + 590, - 510,
+ 610, - 1578, + 626, - 1544, + 590, - 532, + 668, - 448,
+ 672, - 426, + 590, - 556, + 646, - 476, + 674, - 446,
+ 676, - 446, + 676, - 1494, + 610, - 510, + 674, - 1518,
+ 612, - 1558, + 592, - 554, + 648, - 446, + 674, - 1520,
+ 566, - 1598, + 702, - 420, + 674, - 1496, + 612, - 510,
+ 590, - 532, + 590, - 1598, + 672, - 1498, + 610
uint16_t rawData[199] = {4568, 4310, 606, 1600, 674, 446, 612, 1560, 590, 1598, 676, 446, 588, 508, 674, 1516, 676, 446, 616, 486, 588, 1598, 676, 446, 616, 484, 672, 1516, 590, 1576, 616, 504, 674, 1498, 590, 1600, 674, 446, 592, 508, 612, 1578, 676, 1494, 614, 1578, 674, 1516, 676, 1546, 672, 446, 674, 1496, 614, 1580, 672, 444, 674, 450, 566, 530, 614, 504, 676, 424, 610, 534, 674, 426, 610, 1578, 676, 444, 612, 1558, 670, 1518, 674, 426, 590, 528, 676, 1516, 618, 1578, 646, 448, 702, 1492, 566, 534, 658, 486, 612, 1578, 702, 1470, 612, 4688, 4580, 4352, 696, 1496, 672, 446, 676, 1498, 588, 1598, 674, 448, 674, 448, 648, 1518, 610, 488, 636, 488, 610, 1578, 674, 450, 566, 530, 674, 1514, 674, 1494, 674, 448, 592, 1576, 676, 1516, 674, 448, 590, 506, 672, 1520, 702, 1468, 610, 1558, 638, 1554, 612, 1576, 590, 510, 610, 1578, 626, 1544, 590, 532, 668, 448, 672, 426, 590, 556, 646, 476, 674, 446, 676, 446, 676, 1494, 610, 510, 674, 1518, 612, 1558, 592, 554, 648, 446, 674, 1520, 566, 1598, 702, 420, 674, 1496, 612, 510, 590, 532, 590, 1598, 672, 1498, 610}; // COOLIX B29F2C
uint64_t data = 0xB29F2C;
I don't see how you can reproduce this, unless you happen to have the same AC unit.
const uint16_t IrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
// IRCoolixAC ac(IrLed);
IRsend irsend(IrLed);
uint16_t powerOffRawData[199] = {4444, 4434, 590, 1578, 698, 446, 590, 1578, 622, 1596, 622, 500, 644, 476, 644, 1548, 588, 532, 594, 530, 612, 1578, 590, 532, 588, 534, 672, 1518, 594, 1598, 590, 510, 612, 1580, 644, 480, 612, 1578, 644, 1548, 644, 1548, 594, 1598, 642, 506, 644, 1550, 644, 1548, 594, 1600, 644, 478, 644, 478, 642, 480, 644, 478, 642, 1548, 594, 530, 590, 532, 614, 1578, 644, 1548, 594, 1600, 588, 534, 566, 556, 588, 530, 590, 532, 586, 514, 612, 532, 588, 532, 590, 534, 588, 1578, 642, 1576, 642, 1550, 588, 1602, 588, 1580, 642, 4712, 4546, 4406, 588, 1606, 642, 478, 644, 1550, 590, 1604, 588, 534, 586, 532, 586, 1582, 642, 480, 642, 480, 668, 1550, 642, 480, 642, 478, 642, 1552, 612, 1578, 586, 538, 588, 1580, 674, 472, 590, 1602, 586, 1580, 618, 1576, 642, 1548, 594, 530, 590, 1584, 608, 1578, 644, 1550, 642, 480, 642, 478, 642, 480, 642, 480, 642, 1550, 590, 530, 592, 528, 592, 1602, 642, 1548, 592, 1604, 586, 584, 642, 480, 640, 480, 640, 480, 642, 480, 642, 480, 642, 480, 642, 480, 642, 1552, 590, 1604, 588, 1578, 642, 1552, 640, 1550, 592}; // COOLIX B27BE0
void setup() {
// ac.begin();
irsend.begin();
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
}
void loop() {
Serial.println("Sending...");
// this works
irsend.sendRaw(powerOffRawData, 199, 38);
delay(5000);
// this doesn't work
irsend.sendCOOLIX(0xB2BF2C);
delay(5000);
}
IR receiver (VS1838B) is connected to VCC, ground, pin D5
IR LED is connected as per the wiki, with a 2N3904 transistor and no other components.
Yes
This is my first time using this library.
I also tried the auto_analyse_raw_data.py script, but it crashed:
Found 199 timing entries.
Potential Mark Candidates:
[4598, 728]
Potential Space Candidates:
[4654, 4374, 1584, 558]
Guessing encoding type:
Looks like it uses space encoding. Yay!
Guessing key value:
kHdrMark = 4589
kHdrSpace = 4373
kBitMark = 660
kOneSpace = 1520
kZeroSpace = 458
kSpaceGap = 4654
Decoding protocol based on analysis so far:
kHdrMark+kHdrSpace+101100100100110110111111010000000110110010010011GAP(4654)Traceback (most recent call last):
File "./auto_analyse_raw_data.py", line 432, in <module>
main()
File "./auto_analyse_raw_data.py", line 428, in main
parse_and_report(data, arg_options.margin, arg_options.gen_code)
File "./auto_analyse_raw_data.py", line 247, in parse_and_report
total_bits = decode_data(message, defines, function_code, output)
File "./auto_analyse_raw_data.py", line 315, in decode_data
message.display_binary(binary_value)
File "./auto_analyse_raw_data.py", line 88, in display_binary
(bits, "0x{0:0{1}X}".format(num, bits / 4),
ValueError: Precision not allowed in integer format specifier
I don't have a lot of experience with python, and didn't figure out how to fix this error.
If someone can help me decode the raw data (or get the auto analyse script to work), I wouldn't mind writing the code to support my unit. If the unit is too obscure to be included in the official library I can of course make my own fork.
Thanks in advance for any help!
For starters, thanks for the excellent bug report. It helps a lot!
Looking at the raw data, it's longer than what I would expect. After a quick look, I think the message is being repeated. It may be the case that this protocol requires a single repeat by default.
So, try a call of:
irsend.sendCOOLIX(0xB2BF2C, 1); // with 1 repeat. i.e. two messages sent.
In the meantime, I'll look into it deeper/further and also try to work out why auto_analyse_raw_data.py crashed.
Let me know if that works. I think you're the first person who's provided the raw data for a Coolix remote.
FWIW, auto_analyse_raw_data.py appears to be working for me.
e.g.
IRremoteESP8266/tools$ cat /tmp/j
uint16_t powerOffRawData[199] = {4444, 4434, 590, 1578, 698, 446, 590, 1578, 622, 1596, 622, 500, 644, 476, 644, 1548, 588, 532, 594, 530, 612, 1578, 590, 532, 588, 534, 672, 1518, 594, 1598, 590, 510, 612, 1580, 644, 480, 612, 1578, 644, 1548, 644, 1548, 594, 1598, 642, 506, 644, 1550, 644, 1548, 594, 1600, 644, 478, 644, 478, 642, 480, 644, 478, 642, 1548, 594, 530, 590, 532, 614, 1578, 644, 1548, 594, 1600, 588, 534, 566, 556, 588, 530, 590, 532, 586, 514, 612, 532, 588, 532, 590, 534, 588, 1578, 642, 1576, 642, 1550, 588, 1602, 588, 1580, 642, 4712, 4546, 4406, 588, 1606, 642, 478, 644, 1550, 590, 1604, 588, 534, 586, 532, 586, 1582, 642, 480, 642, 480, 668, 1550, 642, 480, 642, 478, 642, 1552, 612, 1578, 586, 538, 588, 1580, 674, 472, 590, 1602, 586, 1580, 618, 1576, 642, 1548, 594, 530, 590, 1584, 608, 1578, 644, 1550, 642, 480, 642, 478, 642, 480, 642, 480, 642, 1550, 590, 530, 592, 528, 592, 1602, 642, 1548, 592, 1604, 586, 584, 642, 480, 640, 480, 640, 480, 642, 480, 642, 480, 642, 480, 642, 480, 642, 1552, 590, 1604, 588, 1578, 642, 1552, 640, 1550, 592}; // COOLIX B27BE0
IRremoteESP8266/tools$ ./auto_analyse_raw_data.py -f /tmp/j
Found 199 timing entries.
Potential Mark Candidates:
[4546, 698]
Potential Space Candidates:
[4712, 4434, 1606, 584]
Guessing encoding type:
Looks like it uses space encoding. Yay!
Guessing key value:
kHdrMark = 4495
kHdrSpace = 4420
kBitMark = 618
kOneSpace = 1572
kZeroSpace = 504
kSpaceGap = 4712
Decoding protocol based on analysis so far:
kHdrMark+kHdrSpace+101100100100110101111011100001001110000000011111GAP(4712)
Bits: 48
Hex: 0xB24D7B84E01F (MSB first)
0xF80721DEB24D (LSB first)
Dec: 196045854531615 (MSB first)
272709516702285 (LSB first)
Bin: 0b101100100100110101111011100001001110000000011111 (MSB first)
0b111110000000011100100001110111101011001001001101 (LSB first)
kHdrMark+kHdrSpace+101100100100110101111011100001001110000000011111
Bits: 48
Hex: 0xB24D7B84E01F (MSB first)
0xF80721DEB24D (LSB first)
Dec: 196045854531615 (MSB first)
272709516702285 (LSB first)
Bin: 0b101100100100110101111011100001001110000000011111 (MSB first)
0b111110000000011100100001110111101011001001001101 (LSB first)
Total Nr. of suspected bits: 96
That's the raw data line from your code example. If it is breaking on a different input, can you please supply it to me and I can see what might be causing it.
Now, looking at that output, yes, it is two messages back to back, with the same payload. i.e. message + repeat.
Thanks for the help and feedback!
I figured out the problem with the auto analyse script - I was running it on python 3.7! Running it on python 2.7 works. Sorry about that.
Unfortunately irsend.sendCOOLIX(0xB2BF2C, 1); didn't work.
I even tried 2, 3, 4 and 5 repeats, but still nothing.
Where do we go from here? I can of course provide more raw data from the remote if that's helpful.
I'll keep looking at it myself and see if I figure something out.
I figured it out! I needed to do irsend.sendCOOLIX(0xB2BF2C, kCoolixBits, 1) because repeat is the third parameter! It works!!!
Thanks again for your help.
And I see you've already added support for the alt auto fan speed, thanks for that as well!
Another thing: void IRCoolixAC::send() currently doesn't support setting a repeat. I guess this could be solved by overloading the method with a void IRCoolixAC::send(uint16_t repeat) method - or is there another preferred way to do it? Just changing the current method to void IRCoolixAC::send(uint16_t repeat = 0) ?
@abstrakct Sorry for giving you the incorrect code example. i.e. I forgot to add the bit length.
You correctly figured it out thankfully.
I wanted to wait till you confirmed the repeat solution worked for you before I coded a solution for the class method.
I've just pushed a change to that branch that should make the class approach work for you.
e.g.
ac.begin();
ac.setPower(true);
ac.setTemp(20);
ac.setMode(kCoolixHeat);
ac.setFan(kCoolixFanAuto);
ac.send(1); // Send with a single repeat. i.e. two messages back-to-back
Let me know if that works please.
I'll look into why Python3.7 has an issue with the decoder.
@Hamper & @Hollako, Can you two please see if the Raw messages (via IRrecvDumpV2) from your Coolix remotes look like the ones here? i.e. approx 199 elements long vs. approx 98 elements long.
Also, can you test/confirm if you use sendCOOLIX() with a repeat, that it works as expect with your A/C units?
e.g.
irsend.sendCOOLIX(code_to_send, kCoolixBits, 1);
I'm asking as I'd like to investigate if we should change the default to be a repeat of 1. i.e. would that change break things for other Coolix A/C users.
Xref #484
@crankyoldgit I have tested the new branch, and can confirm that the new method works as expected!
Thanks again for excellent support and help. Now I can control my AC via MQTT/Home Assistant!
@abstrakct Thanks for the confirmation that the patch works.
FYI, this patch has been included in the newly released v2.5.4 of the library.
Most helpful comment
I figured it out! I needed to do
irsend.sendCOOLIX(0xB2BF2C, kCoolixBits, 1)because repeat is the third parameter! It works!!!Thanks again for your help.
And I see you've already added support for the alt auto fan speed, thanks for that as well!