Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for enhanced Midea Library (Coolix library) setSensorTemp not recognized by AC #1318

Closed
fraschizzato opened this issue Nov 4, 2020 · 82 comments · Fixed by #1340
Closed

Comments

@fraschizzato
Copy link

I'm trying to add some commands to Midea library, but at this time I can't really understand how.
Tried to pass the single command modifying the Swing command but without success.

The commands are related to the follow_me function. The goal is to use an esp to send room temperature to the ac, acting as remote thermostat.
I've grabbed a lot of data and get it work with arduino (IRremote library) and attiny85.

The tipical messages is: 0xBA45 (address) and 0xD22D0EF1 (message)
The address is always the same, message is for half Room Temperature and the other half Temperature Setted.

In that case:
Byte1 (D2) is room temperature 18°C - Hex conversion of the Decimal RoomTemp+192
Byte2 (2D) is complementar value of Byte1 --> So FF-D2 =2D --> FF-Byte1 = Byte 2
Byte3 (0E) is Temperature setting and Mode --> first nibble is temperature accordingly to the midea table, second nibble is the mode accordingly the same table
Byte4 (F1) the same as byte2 but for byte 3

The setting in the message does not affect the ac operational mode, so if the messages says 30°C Cool but the AC is at 17°C Heat it will remain 17°C Heat.

The Remote used is a RG57A7/BGEF - The AC is a Kaysun (Midea). Other working remotes with the device are RG57A6/BGEFU1 and RG57B/BGE (the one supplied with the AC but without FollowMe function - however the AC supports It)

All the grabbed data is in this google sheet: https://docs.google.com/spreadsheets/d/1f4dTW9s5U7kJhvi8UtJVX93kKzXYAMLAMR5qrxaTaxc/edit?usp=sharing

The messages are used also if FollowMe Function is not enabled in the AC (If I enable the function in another room and then put the remote back the ac starts using remote temperature as ambient temp).

Remote RG57A7/BGEF was used because the messages logic seems to be more simple to understand.

The remote sends a message every 2 minutes, after 7 minutes without messages the AC unit starts using it's own room temperature, a new message will restart the follow me mode.

In the link, in "MyTable" sheet there's a list of all tested commands 0 to 40°C
The other sheet are all the grabbed data with mode/temp/special function for each remote, also with some decoding.

As the variety of commands (and remotes) it could be usefull to add a generic send to the Midea Library that accepts byte data. Something like the ir_AC library from that fork of IRremote (https://github.com/marceloburegio/Arduino-IRremote)

I've made a simple sender with esp-01 but the data sended is not working - checked with arduino receiver and messages are not the ones I send. I don't think is an hardware fault but it would be great If someone can post a working circuit schematic.
I was Using GPIO2 and TSAL6400, tried with/without 2n2222 transistor and/or different resistor.
Also the signal is too low and I can't reach distance over 1meter (neither the "bad" message can be received). Original remote does flawlessly about 7-8 meters (not tested over - end of the room XD)
The room temperature is achieved with DS18B20 using RX-Pin that I didn't use.
Any help is apreciated, thanks in advance.

@crankyoldgit
Copy link
Owner

As the variety of commands (and remotes) it could be usefull to add a generic send to the Midea Library that accepts byte data.

That already exists. See: https://crankyoldgit.github.io/IRremoteESP8266/doxygen/html/classIRsend.html#a37d91b3a77b36509abdc53e2fec20a67

I'll look at the rest of the issue later when I get some spare time.

@crankyoldgit
Copy link
Owner

I've made a simple sender with esp-01 but the data sended is not working - checked with arduino receiver and messages are not the ones I send. I don't think is an hardware fault but it would be great If someone can post a working circuit schematic.

If you checked the Wiki page(s) for this project, you would have found: https://github.com/crankyoldgit/IRremoteESP8266/wiki/ESP01-Send-&-Receive-Circuit#sender

@fraschizzato
Copy link
Author

Ok, many thanks, I will give a try in the next days to give a feedback.
Sorry, I've seen the wiki but I've missed the circuit part, thanks for linking that.
Probably the problem in transmission is related to the "instability" of GPIO0-2, I will try with GPIO-3.
Same for sendMidea, I was thinking that some conversion were made as the sended message was received differently, so the problem could be the hardware.
Only a question about sendMidea: using previous example, the command would be sendMidea( 0xBA45D22D0EF1, 48, 1) or I have to add the zero's like the hardcoded swing mode, so it will be sendMidea( 0x0000BA45D22D0EF1, 48, 1)? Obviously passing data as uint64_t.
Thanks

@crankyoldgit
Copy link
Owner

Only a question about sendMidea: using previous example, the command would be sendMidea( 0xBA45D22D0EF1, 48, 1)

That should work, assuming you want to send it with a single repeat. i.e. two messages.
Otherwise just sendMidea(0xBA45D22D0EF1); will work. The default is 48 bits, and no repeats.
e.g.

const uint16_t kMideaBits = 48;
const uint16_t kNoRepeat = 0;
const uint16_t kMideaMinRepeat = kNoRepeat;

If the hexadecimal code (0xBA45D22D0EF1) is what IRrecvDumpV2-3 reported, then yes, that value should work.

@fraschizzato
Copy link
Author

Yes, the data is from IRrecvDump but from a forked version on IRremote that supports 48bit. That shows 0xBA45 as address and the rest as data. I suppose that's a trick to send 48bit message without full modification of the library. Sending that data (with IRremote) works. And probably all my problems with IRremoteESP8266 were from GPIO0-2 Issue.
I will give a feedback soon.

@crankyoldgit
Copy link
Owner

Yes, the data is from IRrecvDump but from a forked version on IRremote that supports 48bit.

I can't speak for someone else's library. They may have a different bit order for how they construct the message. So, only if you capture it with this library can you be sure. But hey, try it. Good luck.

@fraschizzato
Copy link
Author

fraschizzato commented Nov 4, 2020

Ok, thanks, I've made a mistake considering both library as the same.
Here the first catch with ESP board and IRremoteESP8266 library:

16:06:29.303 -> Protocol  : COOLIX
16:06:29.303 -> Code      : 0xBA576E (24 Bits)
16:06:29.303 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 2 (Med), Temp: 21C, Zone Follow: Off, Sensor Temp: 23C
16:06:29.350 -> uint16_t rawData[199] = {4418, 4344,  550, 1622,  524, 520,  550, 1622,  540, 1606,  530, 1616,  524, 520,  550, 1620,  524, 520,  550, 520,  550, 1622,  524, 520,  574, 498,  550, 522,  550, 1622,  522, 522,  550, 1622,  524, 520,  552, 1620,  524, 520,  550, 1622,  524, 520,  550, 1622,  524, 1622,  522, 1622,  524, 1620,  522, 520,  552, 1622,  524, 522,  550, 1622,  522, 520,  550, 520,  552, 520,  550, 520,  550, 1622,  522, 1622,  524, 520,  550, 1622,  524, 1620,  522, 1622,  524, 520,  552, 1622,  522, 522,  550, 520,  550, 1622,  524, 520,  552, 520,  552, 520,  550, 1622,  522, 5182,  4392, 4370,  550, 1594,  550, 522,  548, 1594,  552, 1592,  552, 1592,  552, 518,  578, 1568,  576, 494,  578, 496,  576, 1568,  578, 494,  552, 518,  578, 492,  554, 1590,  552, 520,  578, 1566,  578, 492,  578, 1566,  578, 494,  578, 1566,  580, 494,  578, 1564,  578, 1566,  580, 1564,  580, 1564,  580, 490,  580, 1566,  580, 492,  578, 1566,  580, 492,  580, 492,  580, 492,  580, 490,  580, 1566,  578, 1566,  578, 492,  580, 1564,  580, 1564,  580, 1564,  580, 492,  578, 1566,  580, 492,  580, 494,  578, 1564,  578, 494,  580, 492,  578, 492,  578, 1566,  578};  // COOLIX BA576E
16:06:29.443 -> uint64_t data = 0xBA576E;

The unit is recognized as Coolix with only 24 bit data. Follow me temperature is already reported! Unfortunatly Zone Follow remains off also if enabled.
Now I'm waiting first FollowMe messages and then make a try on transmission.

I'm using a NodeMCU v1 because with ESP-01 (tried gpio 0-2-3) I always get strange data, didn't know why. It's like something other happen on the gpio (Ir receiver led keeps blinking "randomly"). In my experience that the first time with a similiar issue with esp01.

Next follow_up (probably for closing the issues) will be about transmission and confirmation of support for that remote and AC unit (Kaysun) midea Based (recognized as Coolix)

Meanwhile, here the message from Follow Me Mode, recognized correctly.

16:12:39.384 -> Protocol  : COOLIX
16:12:39.384 -> Code      : 0xBAD76E (24 Bits)
16:12:39.384 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 21C, Zone Follow: Off, Sensor Temp: 23C
16:12:39.431 -> uint16_t rawData[199] = {4418, 4346,  550, 1622,  524, 520,  550, 1622,  522, 1622,  524, 1622,  524, 522,  550, 1620,  546, 500,  550, 522,  550, 1622,  524, 520,  550, 520,  550, 522,  550, 1620,  550, 496,  550, 1622,  526, 1620,  548, 1598,  524, 522,  550, 1622,  526, 518,  550, 1622,  524, 1620,  524, 1620,  548, 498,  550, 522,  550, 1620,  524, 520,  550, 1622,  524, 520,  574, 498,  550, 520,  550, 522,  550, 1620,  538, 1608,  548, 496,  550, 1622,  524, 1620,  524, 1620,  550, 496,  550, 1622,  548, 496,  550, 522,  550, 1622,  548, 498,  550, 522,  550, 520,  552, 1620,  526, 5182,  4418, 4344,  576, 1594,  550, 496,  550, 1620,  550, 1594,  550, 1596,  550, 496,  576, 1594,  526, 520,  574, 498,  550, 1620,  526, 520,  574, 498,  550, 520,  552, 1620,  550, 496,  550, 1620,  548, 1594,  528, 1618,  526, 520,  550, 1620,  526, 520,  576, 1594,  526, 1618,  552, 1592,  550, 496,  574, 498,  552, 1618,  528, 520,  550, 1618,  528, 520,  574, 496,  552, 522,  572, 498,  548, 1620,  526, 1618,  550, 496,  574, 1596,  524, 1598,  548, 1618,  524, 524,  548, 1598,  548, 522,  550, 524,  548, 1598,  546, 526,  546, 526,  544, 524,  548, 1596,  548};  // COOLIX BAD76E
16:12:39.524 -> uint64_t data = 0xBAD76E;

@fraschizzato fraschizzato changed the title Suggestion for enhanced Midea Library Suggestion for enhanced Midea Library (Coolix library) Nov 4, 2020
@fraschizzato
Copy link
Author

fraschizzato commented Nov 4, 2020

Ok, all command works with Coolix integration, except for the one I need... The setSensorTemp is not accepted/used by the AC. It seems does nothing, probably i'm doing something wrong. Here the code I use and tested ok with on/off, mode, setTemp, etc.

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Coolix.h>

const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRCoolixAC ac(kIrLed);  // Set the GPIO to be used to sending the message.

void setup() {
  ac.begin();
  Serial.begin(115200);
}

void loop() {
  Serial.println("Sending...");

  // Set up what we want to send. See ir_Coolix.cpp for all the options.
  ac.setFan(kCoolixFanZoneFollow);
  ac.setSensorTemp(17);
#if SEND_COOLIX
  // Now send the IR signal.
  ac.send();
  Serial.println("Sended");
#else  // SEND_COOLIX
  Serial.println("Can't send because SEND_ARGO has been disabled.");
#endif  // SEND_COOLIX

  delay(60000);
}

In the other end the message sent appear correct:

17:59:31.264 -> Protocol  : COOLIX
17:59:31.264 -> Code      : 0xBAD1C8 (24 Bits)
17:59:31.264 -> Mesg Desc.: Power: On, Mode: 2 (Auto), Fan: 6 (Zone Follow), Temp: 25C, Zone Follow: Off, Sensor Temp: 17C
17:59:31.264 -> uint16_t rawData[199] = {4670, 4452,  582, 1662,  552, 526,  582, 1658,  552, 1658,  554, 1658,  552, 526,  582, 1658,  530, 550,  582, 524,  582, 1658,  552, 524,  582, 526,  582, 526,  558, 1682,  550, 526,  582, 1658,  552, 1658,  528, 1684,  552, 526,  582, 1660,  526, 550,  582, 524,  560, 548,  556, 1684,  528, 550,  558, 548,  582, 1658,  526, 550,  558, 1684,  526, 1684,  526, 1684,  528, 552,  556, 1684,  526, 1684,  526, 550,  558, 550,  556, 1684,  526, 552,  556, 550,  556, 552,  556, 552,  556, 550,  554, 1686,  524, 1686,  526, 552,  556, 1658,  554, 1656,  554, 1656,  582, 5214,  4742, 4376,  590, 1622,  590, 518,  588, 1622,  590, 1622,  588, 1624,  586, 520,  588, 1622,  588, 520,  586, 520,  586, 1624,  586, 522,  584, 520,  586, 520,  588, 1624,  586, 522,  586, 1626,  586, 1626,  584, 1626,  584, 522,  584, 1628,  582, 524,  582, 524,  584, 524,  584, 1628,  584, 524,  582, 524,  582, 1628,  582, 524,  580, 1630,  580, 1630,  580, 1630,  580, 528,  580, 1632,  578, 1632,  578, 528,  580, 528,  578, 1632,  578, 528,  578, 530,  578, 530,  578, 530,  576, 528,  580, 1632,  578, 1632,  578, 530,  576, 1636,  552, 1660,  574, 1636,  550};  // COOLIX BAD1C8
17:59:31.353 -> uint64_t data = 0xBAD1C8;

Here the original remote one:

16:12:39.384 -> Protocol  : COOLIX
16:12:39.384 -> Code      : 0xBAD76E (24 Bits)
16:12:39.384 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 21C, Zone Follow: Off, Sensor Temp: 23C
16:12:39.431 -> uint16_t rawData[199] = {4418, 4346,  550, 1622,  524, 520,  550, 1622,  522, 1622,  524, 1622,  524, 522,  550, 1620,  546, 500,  550, 522,  550, 1622,  524, 520,  550, 520,  550, 522,  550, 1620,  550, 496,  550, 1622,  526, 1620,  548, 1598,  524, 522,  550, 1622,  526, 518,  550, 1622,  524, 1620,  524, 1620,  548, 498,  550, 522,  550, 1620,  524, 520,  550, 1622,  524, 520,  574, 498,  550, 520,  550, 522,  550, 1620,  538, 1608,  548, 496,  550, 1622,  524, 1620,  524, 1620,  550, 496,  550, 1622,  548, 496,  550, 522,  550, 1622,  548, 498,  550, 522,  550, 520,  552, 1620,  526, 5182,  4418, 4344,  576, 1594,  550, 496,  550, 1620,  550, 1594,  550, 1596,  550, 496,  576, 1594,  526, 520,  574, 498,  550, 1620,  526, 520,  574, 498,  550, 520,  552, 1620,  550, 496,  550, 1620,  548, 1594,  528, 1618,  526, 520,  550, 1620,  526, 520,  576, 1594,  526, 1618,  552, 1592,  550, 496,  574, 498,  552, 1618,  528, 520,  550, 1618,  528, 520,  574, 496,  552, 522,  572, 498,  548, 1620,  526, 1618,  550, 496,  574, 1596,  524, 1598,  548, 1618,  524, 524,  548, 1598,  548, 522,  550, 524,  548, 1598,  546, 526,  546, 526,  544, 524,  548, 1596,  548};  // COOLIX BAD76E
16:12:39.524 -> uint64_t data = 0xBAD76E;

Tested a second remote (working with the same AC unit).
It' recognized as MIDEA by dumpV3 - So i've started trying with Midea integration.
Library seems to not support follow Me messages, tipical messages about FollowMe are:

Follow Me On
18:09:13.819 -> Protocol  : MIDEA
18:09:13.819 -> Code      : 0xA4A347FF15B1 (48 Bits) 
Follow Me Message 21°C
18:12:09.846 -> Protocol  : MIDEA
18:12:09.846 -> Code      : 0xA4A3477F1673 (48 Bits)
Follow Me Message 22°C
A4A3477F1772
FollowMe Message 25°C
A4A3477F1A7B
FollowMe Message 24°C
A4A3477F1979

The moving part (last 2 byte) is:
First byte = Temp celsius + 1 (so dec of that byte minus 1 is the room temp)
Second byte is CRC of the whole packet, accordingly to the midea google sheet (linked in the Midea cpp)
Fixed part (as assumed before) must be the mode/tempSet

First declared issues (not corresponding data sent/received) is still there.
If i send using ac.sendMidea(0xA4A3477F1979); i get on the receiver side:

18:48:40.218 -> Protocol  : UNKNOWN
18:48:40.218 -> Code      : 0x2800A054 (50 Bits)
18:48:40.218 -> uint16_t rawData[99] = {4466, 4522,  550, 1726,  532, 572,  574, 1698,  550, 554,  574, 556,  572, 1700,  550, 556,  572, 554,  572, 1698,  550, 552,  578, 1696,  552, 554,  576, 552,  574, 554,  572, 1700,  550, 1698,  550, 554,  574, 1698,  550, 578,  550, 556,  574, 552,  576, 1696,  552, 1696,  574, 1674,  552, 552,  576, 1674,  574, 1696,  554, 1696,  552, 1696,  580, 1646,  602, 1668,  552, 1672,  604, 548,  580, 548,  578, 550,  578, 1646,  606, 1644,  604, 548,  580, 548,  580, 1644,  604, 548,  580, 1644,  604, 1642,  606, 1644,  606, 1642,  604, 548,  584, 542,  582, 1650,  606};  // UNKNOWN 2800A054

Curiosity: I've tried freezing both remotes, they still sends data at 0°C (not grabbed with IRremoteESP8266 library but with IR remote). Same about over 30°C. So also Colix integration (that fixes limit between 16-30°C) is not completely true.

@fraschizzato fraschizzato changed the title Suggestion for enhanced Midea Library (Coolix library) Suggestion for enhanced Midea Library (Coolix library) setSensorTemp not recognized by AC Nov 4, 2020
@crankyoldgit
Copy link
Owner

not grabbed with IRremoteESP8266 library but with IR remote

Can you please make it clear in your reports/data when you are NOT using our library?

The raw data you collected (UNKNOWN 2800A054) is only half of a MIDEA message.

I've verified that our library is correctly sending a full length MIDEA message via sendMidea() and that it also can decode that sent message too. See: 1ba5a68

@fraschizzato
Copy link
Author

Yes, sorry. Last two posts are with Your library only. For sending and receiving i'm using two esp8266 board (wemos clone), both with Your library, one with the sending sketch above (modified version of the argo example) and the other with IRreceiveDumpV3 or V2.
The message from the second remote is correctly reported as midea (0xA4A3477F1979), if I try to send the same data with esp, the receiver (same used for remote) receives only the UNKNOWN data.
thanks for your time.

@crankyoldgit
Copy link
Owner

if I try to send the same data with esp, the receiver (same used for remote) receives only the UNKNOWN data.

Please post your code for that. You haven't provided that. As far as I can tell via my own testing, irsend.sendMidea(0xA4A3477F1979); is doing exactly the right thing. I suggest you re-check your code.

@fraschizzato
Copy link
Author

Here the code, I've seen now the error...

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Midea.h>

const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend ac(kIrLed);  // Set the GPIO to be used to sending the message.

void setup() {
  ac.begin();
  Serial.begin(115200);
}

void loop() {
  Serial.println("Sending...");

  // Set up what we want to send. See ir_Coolix.cpp for all the options.
#if SEND_COOLIX
  // Now send the IR signal.
  ac.sendMidea(0xA4A3477F1979);
  Serial.println("Sended");
#else  // SEND_
  Serial.println("Can't send because SEND_ARGO has been disabled.");
#endif  // SEND_COOLIX

  delay(60000);
}

The fault I suppose is in if SEND_COOLIX , now I think It has to be SEND_MIDEA
I will give a try and probably the sendMidea issues is my fault, have to check if the data does the followMe trick.

However I can't understand why with Coolix Integration works flawlessly with all commands but not with the setSensorTemp
data sended from the remote is the same of the esp (checked as mentioned before) but the AC doesn't get that.
Thanks

@fraschizzato
Copy link
Author

Corrected code now works, device responds correctly. Final report is:

My Device KaysunAC works with Coolix Integration for all commands except FollowMe mode (setSensorTemp()), data is sended correctly but AC does not respond about that. Remote used for tests is RG57A7/BGEF

My Device also works correctly with Midea Integration for all commands, excpept FollowMe that is not implemented (more data below). The FollowMe code from the remote, if replied to the device, works and sets AC room temperature to sended value). Remote used for tests is RG57A6/BGEFU1.

The FM mode is listed in the google-sheet from cpp (https://docs.google.com/spreadsheets/d/1TZh4jWrx4h9zzpYUI9aYXMl1fYOiqu-xVuOOMqagxrs/edit?usp=sharing)
I think temperature data is in °F, in my case it's in °Celsius, So that
0xA482407F174D is setTemp 17°C and roomTemp 22°C (Auto mode-fan Auto)
0xA482487F1644 is setTemp 22°C and roomTemp 21°C (Auto mode-fan Auto)
Where Byte4 is Room Temperature in the form HEX2DEC(Byte4)-1

Thanks for the support, hope that can be helpfull for full integration

@crankyoldgit
Copy link
Owner

My Device KaysunAC works with ...

Any chance you can provide us with the Model number for the actual Kaysun A/C so we can add it to the list of supported devices?

crankyoldgit added a commit that referenced this issue Nov 5, 2020
@crankyoldgit
Copy link
Owner

Where Byte4 is Room Temperature in the form HEX2DEC(Byte4)-1

Can you elaborate/expand on this please?
Your spreadsheet data for Byte4 (https://docs.google.com/spreadsheets/d/1TZh4jWrx4h9zzpYUI9aYXMl1fYOiqu-xVuOOMqagxrs/edit#gid=1191265844&range=P:Q)
Indicates that the Follow Me is in the Fahrenheit scale.
e.g.

0xA482407F174D is setTemp 17°C and roomTemp 22°C (Auto mode-fan Auto)

So Byte[4] would be 0x17, and according to your sheet that would be 56 (decimal) 56°F in Celsius is 13.33°C, which is a long way off your suggested 22°C in the text above.

@crankyoldgit crankyoldgit self-assigned this Nov 5, 2020
crankyoldgit added a commit that referenced this issue Nov 5, 2020
* Verify `sendMidea(0xA4A3477F1979)` decodes properly.

Ref: #1318 (comment)
For #1318

* Update supported Kaysun remote models.
For #1318
@fraschizzato
Copy link
Author

AC Unit is "Kaysun Casual CF".

Addititional remote working with this is RG57B/BGE (the one supplied with the device), correctly reported from Your library as Coolix

Byte[4], converting 17 from hex to dec gives me 23, that's 1 more of display °C (22)
same for other grabs: 1A from hex to dec gives me 26, that's 1 more of display °C (25)

That's not my sheet, is the one listed in the ir_Midea.cpp from your library, I've supposed that it's for °F and so I've listed some data messages in °C to explain how I suppose it works.

@crankyoldgit
Copy link
Owner

AC Unit is "Kaysun Casual CF".

Thanks. I'll update that it supports it under Coolix in a moment.

Byte[4], converting 17 from hex to dec gives me 23, that's 1 more of display °C (22)
same for other grabs: 1A from hex to dec gives me 26, that's 1 more of display °C (25)

Ah. Okay. I get it now. I was confused, obviously.
So, what are the minimum and maximum values for the "room" (sensor) temp based on your analysis?
I'm guessing a value of 0x00 in Byte[4] would be 0°C. Correct? If so, what's the maximum room/sensor temp you've been able to generate?

This is the range we currently allowed for/assumed:

const uint8_t kCoolixSensorTempMin = 16;  // Celsius
const uint8_t kCoolixSensorTempMax = 30;  // Celsius

@crankyoldgit crankyoldgit reopened this Nov 5, 2020
crankyoldgit added a commit that referenced this issue Nov 5, 2020
@fraschizzato
Copy link
Author

Have to re-test with your library but as per assumption 0°C would be 0x01 So decimal would be 1 and minus one it will be 0.

I have to take some dump with your library to confirm that, but (testing with the other lib) I've seen that the device goes down and still trasmit at 0°C. For max temp I have to test it (max reached was 27°C but "limited by the environment"), I haven't found a secure way to heat the remote without damaging it. I suppose that 30 to 50°C can be reached
Any idea about? For 0 i've put the remote in the fridge XD.

The actual grabbed data is the following:

FollowMe Temp | FollowMe message
21 | A4A3477F1673
25 | A4A3477F1A7B
24 | A4A3477F1979
22 | A4A3477F1772
22 | A482407F174D

17°C packet was created manually and it works.

Before tomorrow I can add other values (down to 0°C), and, if a good way is found, also values over 25.

@crankyoldgit
Copy link
Owner

I've updated the branch so you shouldn't need to ac.send(0) for the "step" command.
Please test etc.

I'll try looking into the rest of it later today/tonight.

@fraschizzato
Copy link
Author

Ok, tomorrow I will test.

For FollowMe last byte I think that the problem is in last two bit. Also as reported here (#484) in FollowMe Messages last two bit are 10 instead of 00
In that way the known modes vs FollowMe Modes:

Normal Mode FollowMe
11 00 Heat 1110
10 00 Auto 1010
01 00 Fan/Dry 0110
00 00 Cool 0010

crankyoldgit added a commit that referenced this issue Nov 18, 2020
Hopefully make ZoneFollow work better.

Ref: #1318 (comment)
@crankyoldgit
Copy link
Owner

I've added setting the 2nd last bit (2nd least significant bit) to Zone Follow's control, to the branch. Let me know how it goes.

crankyoldgit added a commit that referenced this issue Nov 18, 2020
* Move to Bit field notation. (FYI @siriuslzx)
* Reduce code duplication.
* Code & comment style cleanup.

For #1318
@fraschizzato
Copy link
Author

fraschizzato commented Nov 18, 2020

All confirmed working:

  • Step Command works with ac.send(); without the need of ac.send(0);
  • Follow Me Messages now are correct and fully working. Keep Note that correct message is created only if also correct fan mode is selected: ac.setFan(kCoolixFanZoneFollow);

In receiver is always reported Zone Follow: Off also if enabled. Now we know that last two bits of mode and fanMode can determine if FollowMe message is sent. But I don't think that report is necessary. By following the logic of "the library has to know the state without assuming anything" the followMe is very difficult to track: there's no way to know if device receives/uses remote data (only way is by cloud/uart key)
Keep in mind that multiple FollowMe Messages causes the unit to refuse (not use) them. A safe spacing is 1 minute between each FollowMe update message. So the "re-send everything" way is not praticable in that case

Here the test code fully working:

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Coolix.h>


const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRCoolixAC ac(kIrLed);  // Set the GPIO to be used to sending the message.

void setup() {
  ac.begin();
  ac.setMode(kCoolixHeat);
  ac.setTemp(24);
  ac.send();
  delay(30000);
  ac.setSwingVStep();
  ac.send();
  delay(15000);
  ac.setSwingVStep();
  ac.send();
  delay(15000);
  ac.setFan(kCoolixFanZoneFollow);
  const uint8_t temp = 19;
  ac.setSensorTemp(temp);
  ac.send();
  delay(60000);
  ac.setSensorTemp(22);
  ac.send();
  delay(60000);
  ac.setSensorTemp(30);
  ac.send();
  delay(60000);
}

void loop() {

}

Tell me if "timer on" and "timer off" mappings are needed.
As per clarification about use: TimerON will turn ON the ac after the selected time (posticipate ON), TimerOFF will turn OFF the AC after the selected time (planned OFF). They can be configured both at the same time to have a "ON window" by setting (as example) ON after 2 hours and OFF after 5 Hours = Running 3 hours after a wait of 2

@crankyoldgit
Copy link
Owner

Okay. Thanks for the confirmation and feedback.

I'll look at setting the ZoneFollow fan mode when ZoneFollow/Sensor Temp is set. And potentially reversing it when it's cleared/unset etc.

As for Timers, they are really a low priority. But if you want to do the analysis, I can try to implement it somehow.

crankyoldgit added a commit that referenced this issue Nov 18, 2020
@crankyoldgit
Copy link
Owner

I should have improved ZoneFollow/FollowMe/SensorTemp etc setting and detection.
You hopefully shouldn't need to call ac.setFan(kCoolixFanZoneFollow); when setting the SensorTemp.

Let me know how it goes etc.

@fraschizzato
Copy link
Author

Sorry for the delay.
Latest commit doesn't produces desidered output, without setting ac.setFan(kCoolixFanZoneFollow); i get:

14:00:21.225 -> Protocol  : COOLIX
14:00:21.225 -> Code      : 0xBAB34E (24 Bits)
14:00:21.225 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 5 (Auto), Temp: 24C, Zone Follow: Off, Sensor Temp: 19C
14:00:21.225 -> uint16_t rawData[199] = {4674, 4434,  594, 1618,  592, 542,  562, 1622,  618, 1594,  594, 1618,  590, 542,  566, 1616,  598, 542,  596, 512,  592, 1592,  594, 540,  596, 512,  594, 512,  594, 1592,  592, 540,  568, 1616,  622, 1590,  622, 512,  596, 1590,  618, 1590,  624, 512,  594, 512,  596, 1588,  618, 1594,  616, 518,  592, 1590,  622, 514,  594, 512,  594, 1590,  622, 1588,  622, 514,  594, 514,  594, 514,  592, 1592,  620, 514,  592, 514,  596, 1586,  624, 1588,  620, 1590,  624, 512,  594, 1590,  620, 514,  596, 1588,  620, 1590,  624, 512,  590, 516,  592, 514,  592, 1590,  620, 5178,  4772, 4348,  616, 1596,  588, 544,  588, 1594,  590, 1620,  592, 1618,  588, 546,  564, 1620,  618, 518,  562, 546,  560, 1624,  614, 520,  564, 544,  560, 546,  558, 1624,  588, 546,  560, 1624,  588, 1624,  588, 548,  558, 1626,  584, 1626,  584, 550,  556, 552,  556, 1626,  584, 1628,  584, 528,  578, 1628,  582, 528,  578, 528,  580, 1630,  582, 1628,  580, 528,  580, 526,  580, 528,  578, 1630,  582, 524,  578, 530,  580, 1630,  580, 1630,  580, 1630,  582, 528,  580, 1630,  580, 528,  580, 1632,  578, 1632,  578, 528,  578, 530,  578, 530,  578, 1632,  578};  // COOLIX BAB34E
14:00:21.319 -> uint64_t data = 0xBAB34E;

It seems that ignores the "fanMode" implementation.
Comparison using ac.setFan(kCoolixFanZoneFollow);

14:05:59.090 -> Protocol  : COOLIX
14:05:59.090 -> Code      : 0xBAD34E (24 Bits)
14:05:59.090 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, Zone Follow: Off, Sensor Temp: 19C
14:05:59.138 -> uint16_t rawData[199] = {4776, 4340,  622, 1590,  624, 512,  594, 1588,  620, 1592,  622, 1588,  594, 540,  594, 1590,  594, 542,  592, 516,  594, 1590,  618, 516,  564, 542,  592, 516,  564, 1620,  592, 542,  564, 1620,  620, 1592,  592, 1618,  594, 542,  576, 1608,  592, 542,  592, 516,  562, 1622,  590, 1620,  590, 546,  560, 548,  560, 1622,  590, 546,  558, 1624,  590, 1622,  588, 548,  558, 550,  558, 548,  560, 1622,  590, 548,  558, 548,  560, 1622,  588, 1624,  586, 1626,  584, 524,  586, 1624,  586, 524,  582, 1626,  584, 1628,  582, 528,  580, 524,  582, 524,  582, 1630,  584, 5214,  4730, 4386,  554, 1658,  578, 528,  580, 1632,  578, 1632,  578, 1634,  578, 528,  578, 1632,  552, 556,  580, 528,  552, 1658,  552, 556,  578, 528,  578, 530,  552, 1660,  564, 542,  552, 1662,  578, 1634,  552, 1660,  552, 556,  576, 1636,  550, 558,  550, 556,  550, 1660,  550, 1662,  576, 532,  550, 558,  576, 1636,  550, 556,  550, 1660,  578, 1634,  552, 556,  550, 558,  550, 556,  550, 1662,  550, 558,  550, 556,  550, 1662,  548, 1662,  548, 1664,  548, 560,  548, 1664,  548, 560,  548, 1664,  548, 1664,  546, 562,  546, 562,  546, 560,  546, 1666,  544};  // COOLIX BAD34E
14:05:59.230 -> uint64_t data = 0xBAD34E;

About Timers: Data seems to not being recognized by the library, here some grabs of Timers ON and OFF, at this stage I can't decode the message logic.

14:08:54.849 -> Timestamp : 000722.393
14:08:54.849 -> Library   : v2.7.12
14:08:54.849 -> 
14:08:54.849 -> Protocol  : UNKNOWN
14:08:54.849 -> Code      : 0x1C0BDB58 (100 Bits)
14:08:54.896 -> uint16_t rawData[199] = {4388, 4356,  548, 1618,  522, 520,  548, 1618,  522, 1616,  524, 520,  550, 520,  548, 1618,  522, 520,  548, 522,  548, 1616,  548, 496,  548, 520,  548, 1618,  522, 1618,  548, 494,  550, 1616,  522, 1618,  524, 520,  550, 1616,  544, 1596,  548, 1592,  524, 1616,  524, 1616,  548, 1592,  524, 520,  548, 1618,  524, 520,  548, 520,  548, 520,  548, 520,  548, 520,  548, 520,  548, 520,  548, 1618,  524, 518,  550, 520,  548, 1618,  524, 1616,  548, 1592,  524, 1616,  548, 496,  546, 522,  548, 520,  552, 518,  548, 520,  548, 522,  548, 522,  550, 1616,  524, 5170,  4382, 4360,  574, 1590,  524, 522,  548, 1616,  524, 1614,  524, 520,  548, 522,  548, 1616,  524, 518,  550, 520,  548, 1616,  526, 520,  548, 520,  550, 1616,  524, 1616,  526, 520,  548, 1616,  524, 1616,  548, 496,  548, 1616,  550, 1590,  524, 1614,  526, 1614,  550, 1592,  524, 1616,  548, 496,  548, 1616,  548, 496,  548, 520,  572, 498,  548, 522,  572, 498,  546, 522,  570, 500,  546, 1616,  548, 496,  570, 498,  548, 1616,  524, 1616,  524, 1616,  528, 1612,  548, 496,  550, 520,  572, 496,  572, 496,  548, 522,  546, 522,  548, 522,  548, 1616,  552};  // UNKNOWN 1C0BDB58
14:08:54.989 -> 
14:08:54.989 -> 
14:09:10.840 -> Timestamp : 000738.356
14:09:10.840 -> Library   : v2.7.12
14:09:10.840 -> 
14:09:10.840 -> Protocol  : UNKNOWN
14:09:10.840 -> Code      : 0x653B54F8 (100 Bits)
14:09:10.840 -> uint16_t rawData[199] = {4382, 4364,  546, 1620,  520, 522,  546, 1620,  520, 1620,  522, 522,  548, 522,  546, 1620,  522, 520,  550, 520,  548, 1618,  522, 520,  546, 524,  546, 1620,  522, 1618,  520, 522,  550, 1618,  522, 1618,  522, 522,  546, 1618,  522, 1618,  522, 1618,  522, 1620,  522, 1618,  524, 1616,  524, 518,  550, 1618,  550, 494,  550, 520,  550, 518,  550, 518,  552, 518,  550, 518,  548, 520,  550, 1616,  520, 522,  552, 518,  550, 1616,  524, 1616,  526, 1614,  524, 1616,  526, 518,  578, 492,  576, 492,  550, 518,  550, 518,  560, 508,  550, 1616,  526, 1614,  554, 5138,  4416, 4328,  584, 1584,  558, 512,  556, 1584,  556, 1562,  580, 512,  556, 514,  556, 1560,  580, 512,  556, 514,  556, 1562,  580, 512,  556, 512,  554, 1562,  580, 1584,  558, 512,  556, 1584,  556, 1584,  556, 514,  556, 1584,  556, 1586,  556, 1584,  556, 1584,  556, 1562,  576, 1586,  556, 514,  558, 1560,  580, 512,  556, 512,  558, 512,  556, 512,  556, 512,  558, 512,  558, 512,  556, 1584,  558, 510,  558, 512,  556, 1582,  556, 1560,  582, 1584,  554, 1562,  584, 510,  556, 514,  558, 510,  558, 512,  558, 510,  556, 512,  558, 1558,  582, 1558,  582};  // UNKNOWN 653B54F8
14:09:10.933 -> 
14:09:10.933 -> 
14:09:17.998 -> Timestamp : 000745.545
14:09:17.998 -> Library   : v2.7.12
14:09:17.998 -> 
14:09:17.998 -> Protocol  : UNKNOWN
14:09:17.998 -> Code      : 0x18EAA908 (100 Bits)
14:09:18.046 -> uint16_t rawData[199] = {4384, 4358,  550, 1620,  522, 520,  550, 1618,  524, 1618,  522, 520,  548, 522,  548, 1618,  522, 522,  548, 522,  548, 1618,  524, 520,  548, 520,  548, 1618,  548, 1592,  524, 520,  550, 1618,  548, 1592,  524, 518,  550, 1618,  524, 518,  550, 520,  550, 520,  548, 520,  550, 1616,  526, 518,  552, 1616,  524, 520,  550, 1616,  524, 1618,  524, 1616,  524, 1616,  524, 518,  550, 520,  548, 1616,  524, 520,  550, 518,  548, 1618,  522, 1618,  520, 522,  548, 518,  550, 520,  548, 522,  548, 522,  548, 522,  550, 520,  548, 522,  548, 1620,  522, 1618,  522, 5174,  4382, 4360,  548, 1620,  520, 520,  550, 1618,  522, 1618,  520, 522,  548, 520,  548, 1620,  522, 520,  546, 522,  548, 1620,  522, 520,  548, 522,  546, 1620,  522, 1620,  526, 518,  576, 1590,  552, 1588,  554, 492,  576, 1588,  554, 492,  576, 516,  554, 516,  554, 516,  556, 1584,  556, 514,  554, 1586,  556, 514,  554, 1584,  554, 1586,  554, 1562,  578, 1562,  580, 514,  554, 516,  554, 1584,  554, 514,  556, 514,  556, 1584,  556, 1564,  576, 514,  556, 514,  554, 514,  556, 514,  554, 516,  556, 514,  552, 516,  556, 514,  554, 1560,  580, 1586,  554};  // UNKNOWN 18EAA908
14:09:18.137 -> 
14:09:18.137 -> 
14:09:36.313 -> Timestamp : 000763.861
14:09:36.313 -> Library   : v2.7.12
14:09:36.313 -> 
14:09:36.313 -> Protocol  : UNKNOWN
14:09:36.313 -> Code      : 0x814236B0 (100 Bits)
14:09:36.360 -> uint16_t rawData[199] = {4384, 4360,  550, 1618,  524, 518,  550, 1616,  524, 1616,  524, 520,  550, 520,  550, 1614,  524, 518,  554, 518,  550, 1616,  524, 520,  550, 518,  552, 1614,  524, 1616,  528, 516,  552, 1614,  552, 1588,  528, 516,  552, 1614,  552, 492,  552, 518,  552, 516,  578, 490,  554, 1612,  554, 490,  552, 1614,  552, 492,  578, 1588,  528, 1614,  552, 1588,  554, 1588,  552, 518,  554, 516,  554, 1586,  554, 492,  576, 492,  576, 1588,  554, 1586,  554, 490,  580, 516,  552, 516,  554, 1586,  552, 492,  578, 1586,  550, 1588,  554, 1586,  552, 1586,  554, 1588,  554, 5138,  4416, 4328,  582, 1584,  556, 514,  556, 1562,  580, 1582,  556, 514,  554, 516,  556, 1584,  556, 512,  558, 512,  556, 1584,  556, 514,  554, 514,  554, 1562,  578, 1564,  580, 512,  556, 1586,  556, 1584,  556, 514,  556, 1584,  558, 512,  558, 512,  556, 514,  556, 514,  556, 1584,  556, 514,  556, 1584,  556, 514,  556, 1582,  556, 1584,  556, 1584,  558, 1560,  580, 514,  556, 512,  556, 1584,  558, 512,  554, 514,  556, 1586,  556, 1562,  578, 514,  556, 514,  558, 512,  556, 1584,  558, 512,  560, 1556,  584, 1580,  560, 1558,  580, 1560,  582, 1558,  582};  // UNKNOWN 814236B0
14:09:36.453 -> 
14:09:36.453 -> 
14:09:48.054 -> Timestamp : 000775.587
14:09:48.054 -> Library   : v2.7.12
14:09:48.054 -> 
14:09:48.054 -> Protocol  : UNKNOWN
14:09:48.054 -> Code      : 0x948006A8 (100 Bits)
14:09:48.054 -> uint16_t rawData[199] = {4382, 4362,  548, 1620,  522, 520,  546, 1620,  522, 1618,  524, 520,  548, 520,  550, 1618,  522, 522,  548, 520,  550, 1618,  522, 520,  550, 520,  548, 1618,  524, 1616,  524, 522,  548, 1616,  522, 1618,  524, 522,  548, 1616,  524, 1616,  550, 1590,  524, 1616,  524, 1616,  524, 1616,  526, 518,  550, 1616,  524, 518,  578, 492,  550, 518,  552, 520,  550, 520,  550, 520,  550, 518,  552, 1614,  526, 518,  552, 520,  576, 1588,  526, 1614,  526, 1614,  526, 518,  550, 516,  578, 1590,  526, 520,  548, 1616,  526, 1614,  526, 518,  550, 1614,  552, 1588,  528, 5166,  4418, 4328,  582, 1564,  580, 512,  556, 1558,  582, 1584,  556, 514,  556, 512,  558, 1582,  558, 512,  554, 516,  552, 1564,  580, 512,  556, 514,  556, 1584,  556, 1584,  556, 514,  556, 1562,  580, 1584,  556, 514,  556, 1584,  556, 1562,  578, 1584,  558, 1560,  578, 1562,  580, 1584,  556, 514,  554, 1586,  556, 514,  556, 514,  556, 514,  558, 512,  554, 514,  556, 514,  554, 516,  556, 1584,  556, 512,  556, 514,  556, 1586,  554, 1586,  554, 1586,  556, 514,  556, 512,  558, 1582,  556, 514,  556, 1560,  580, 1558,  582, 512,  584, 1530,  582, 1558,  582};  // UNKNOWN 948006A8
14:09:48.193 -> 
14:09:48.193 -> 
14:09:54.037 -> Timestamp : 000781.554
14:09:54.037 -> Library   : v2.7.12
14:09:54.037 -> 
14:09:54.037 -> Protocol  : UNKNOWN
14:09:54.037 -> Code      : 0x41D575D0 (100 Bits)
14:09:54.037 -> uint16_t rawData[199] = {4384, 4360,  546, 1620,  524, 520,  548, 1618,  520, 1620,  524, 520,  548, 520,  548, 1618,  524, 520,  548, 522,  548, 1620,  522, 520,  548, 522,  546, 1618,  524, 1616,  524, 522,  548, 1616,  524, 1618,  524, 518,  550, 1618,  524, 1616,  522, 1618,  524, 1618,  522, 1618,  524, 1616,  524, 518,  550, 1616,  524, 522,  550, 518,  550, 518,  550, 546,  524, 520,  550, 520,  546, 522,  548, 1618,  524, 520,  548, 546,  524, 1616,  526, 1614,  526, 1616,  552, 492,  552, 520,  576, 1588,  526, 1614,  552, 1588,  526, 1616,  550, 1590,  526, 1614,  552, 1590,  552, 5140,  4416, 4328,  584, 1584,  556, 514,  556, 1584,  554, 1586,  554, 516,  554, 514,  554, 1586,  556, 514,  558, 512,  558, 1584,  556, 514,  556, 514,  554, 1562,  578, 1584,  556, 514,  554, 1586,  556, 1586,  554, 514,  554, 1562,  578, 1562,  578, 1586,  554, 1564,  580, 1584,  556, 1584,  558, 512,  556, 1584,  556, 514,  556, 514,  554, 516,  554, 514,  556, 514,  556, 514,  556, 514,  556, 1584,  556, 514,  556, 514,  554, 1562,  578, 1586,  554, 1584,  556, 514,  556, 514,  556, 1560,  580, 1560,  578, 1562,  580, 1562,  580, 1560,  582, 1558,  582, 1558,  582};  // UNKNOWN 41D575D0
14:09:54.130 -> 

crankyoldgit added a commit that referenced this issue Nov 22, 2020
* Add a unit test to verify ZoneFollow Fan speed is set when SensorTemp is set.
* No code changes, just a unit test confirming all is working.

For #1318 (comment)
@crankyoldgit
Copy link
Owner

Sorry for the delay.
Latest commit doesn't produces desidered output, without setting ac.setFan(kCoolixFanZoneFollow); i get:

14:00:21.225 -> Protocol  : COOLIX
14:00:21.225 -> Code      : 0xBAB34E (24 Bits)
14:00:21.225 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 5 (Auto), Temp: 24C, Zone Follow: Off, Sensor Temp: 19C
14:00:21.225 -> uint16_t rawData[199] = {4674, 4434,  594, 1618,  592, 542,  562, 1622,  618, 1594,  594, 1618,  590, 542,  566, 1616,  598, 542,  596, 512,  592, 1592,  594, 540,  596, 512,  594, 512,  594, 1592,  592, 540,  568, 1616,  622, 1590,  622, 512,  596, 1590,  618, 1590,  624, 512,  594, 512,  596, 1588,  618, 1594,  616, 518,  592, 1590,  622, 514,  594, 512,  594, 1590,  622, 1588,  622, 514,  594, 514,  594, 514,  592, 1592,  620, 514,  592, 514,  596, 1586,  624, 1588,  620, 1590,  624, 512,  594, 1590,  620, 514,  596, 1588,  620, 1590,  624, 512,  590, 516,  592, 514,  592, 1590,  620, 5178,  4772, 4348,  616, 1596,  588, 544,  588, 1594,  590, 1620,  592, 1618,  588, 546,  564, 1620,  618, 518,  562, 546,  560, 1624,  614, 520,  564, 544,  560, 546,  558, 1624,  588, 546,  560, 1624,  588, 1624,  588, 548,  558, 1626,  584, 1626,  584, 550,  556, 552,  556, 1626,  584, 1628,  584, 528,  578, 1628,  582, 528,  578, 528,  580, 1630,  582, 1628,  580, 528,  580, 526,  580, 528,  578, 1630,  582, 524,  578, 530,  580, 1630,  580, 1630,  580, 1630,  582, 528,  580, 1630,  580, 528,  580, 1632,  578, 1632,  578, 528,  578, 530,  578, 530,  578, 1632,  578};  // COOLIX BAB34E
14:00:21.319 -> uint64_t data = 0xBAB34E;

It seems that ignores the "fanMode" implementation.
Comparison using ac.setFan(kCoolixFanZoneFollow);

14:05:59.090 -> Protocol  : COOLIX
14:05:59.090 -> Code      : 0xBAD34E (24 Bits)
14:05:59.090 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, Zone Follow: Off, Sensor Temp: 19C
14:05:59.138 -> uint16_t rawData[199] = {4776, 4340,  622, 1590,  624, 512,  594, 1588,  620, 1592,  622, 1588,  594, 540,  594, 1590,  594, 542,  592, 516,  594, 1590,  618, 516,  564, 542,  592, 516,  564, 1620,  592, 542,  564, 1620,  620, 1592,  592, 1618,  594, 542,  576, 1608,  592, 542,  592, 516,  562, 1622,  590, 1620,  590, 546,  560, 548,  560, 1622,  590, 546,  558, 1624,  590, 1622,  588, 548,  558, 550,  558, 548,  560, 1622,  590, 548,  558, 548,  560, 1622,  588, 1624,  586, 1626,  584, 524,  586, 1624,  586, 524,  582, 1626,  584, 1628,  582, 528,  580, 524,  582, 524,  582, 1630,  584, 5214,  4730, 4386,  554, 1658,  578, 528,  580, 1632,  578, 1632,  578, 1634,  578, 528,  578, 1632,  552, 556,  580, 528,  552, 1658,  552, 556,  578, 528,  578, 530,  552, 1660,  564, 542,  552, 1662,  578, 1634,  552, 1660,  552, 556,  576, 1636,  550, 558,  550, 556,  550, 1660,  550, 1662,  576, 532,  550, 558,  576, 1636,  550, 556,  550, 1660,  578, 1634,  552, 556,  550, 558,  550, 556,  550, 1662,  550, 558,  550, 556,  550, 1662,  548, 1662,  548, 1664,  548, 560,  548, 1664,  548, 560,  548, 1664,  548, 1664,  546, 562,  546, 562,  546, 560,  546, 1666,  544};  // COOLIX BAD34E
14:05:59.230 -> uint64_t data = 0xBAD34E;

I think you're not using the latest version of that branch. My tests indicate it's working as inspected. See 44ef381 for how I tested/verified it.

I can also tell you're using an old version of that branch because it's listing "Zone Follow: Off" which was fixed a few commits back. i.e. I think you need to update, and rebuild your both your sender and decoder binaries.

As for the timer messages. They (unfortunately) don't follow the Coolix protocol's integrity check, which is a byte, followed by the same byte but inverted.

e.g.
The message that is marked as "UNKNOWN 948006A8" decodes to:
0xDA7202FDB24D (LSB first) (when using tools/auto_analyse_raw_data.py)

0xDA inverted is 0x25, but the next byte is 0x72. i.e. Integrity check fails.
0x02 inverted is 0xFD, which does match the next byte, 0xFD.
0xB2 inverted is 0x4D, which does match the next byte, 0x4D.

Thus, we can't decode it as COOLIX nor can sendCOOLIX() send as it contains more than 24 bits (kCoolixBits) of info and not in the correct structure.

If we want to add native ability to send & decode these Coolix-like messages to the library, we will have to add it under a different protocol. Honestly, I think it will be a mess to shoe-horn support for them into the IRCoolixAC class. I.e. I'm against it. ;)
I can add a COOLIX-LIKE protocol for decoding and sending them, but as mentioned here and elsewhere, Timers are pretty much the lowest priority as you're better controlling the device by sending an IR message at the correct time, rather than telling the A/C in advance. This gives far better timing control and functionality etc.

@fraschizzato
Copy link
Author

I think the same about timers, if it was easy (like in Midea) it would be a feature, but at this stage is a loss of time.
My receiver uses the old library version but in the sender I have the lastest Coolix branch. I will redo a test from a clean environment.

@crankyoldgit
Copy link
Owner

Hopefully your rebuild went well, as per the unit test example I added, the following should build/send your 0xBAD34E code:

  IRCoolixAC ac(kGpioUnused);
  ac.setPower(true);
  ac.setMode(kCoolixHeat);
  ac.setTemp(24);  // C
  ac.setSensorTemp(19);  // C
  ac.send();

@fraschizzato
Copy link
Author

Confirmed working. Here the code and the result.

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Coolix.h>


const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRCoolixAC ac(kIrLed);  // Set the GPIO to be used to sending the message.

void setup() {
  ac.begin();
  ac.setMode(kCoolixHeat);
  ac.setTemp(24);
  ac.send();
  delay(30000);
  //ac.setFan(kCoolixFanZoneFollow);
  const uint8_t temp = 19;
  ac.setSensorTemp(temp);
  ac.send();
  delay(60000);
  ac.setSensorTemp(22);
  ac.send();
  delay(60000);
  ac.setSensorTemp(30);
  ac.send();
  delay(60000);
}

void loop() {

}
17:13:30.863 -> IRrecvDump is now running and waiting for IR input on Pin 4
17:13:35.643 -> Timestamp : 000004.854
17:13:35.643 -> Library   : v2.7.12
17:13:35.643 -> 
17:13:35.643 -> Protocol  : COOLIX
17:13:35.643 -> Code      : 0xB2BF4C (24 Bits)
17:13:35.643 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 5 (Auto), Temp: 24C, Zone Follow: Off, Sensor Temp: Off
17:13:35.690 -> uint16_t rawData[199] = {4690, 4448,  558, 1684,  558, 548,  558, 1654,  558, 1630,  560, 572,  558, 550,  556, 1632,  588, 554,  558, 550,  532, 1678,  532, 574,  556, 550,  558, 1628,  584, 1626,  584, 548,  560, 1624,  590, 1622,  590, 544,  560, 1626,  584, 1626,  588, 1650,  560, 1650,  562, 1622,  586, 1626,  590, 542,  562, 1622,  590, 544,  562, 544,  564, 542,  564, 544,  564, 542,  564, 546,  564, 542,  564, 1620,  590, 544,  562, 544,  566, 1646,  564, 1620,  592, 542,  564, 542,  566, 1618,  592, 542,  566, 1618,  592, 1618,  594, 540,  566, 540,  564, 1620,  616, 1596,  592, 5208,  4764, 4354,  588, 1624,  586, 548,  558, 1626,  584, 1624,  588, 548,  556, 550,  556, 1626,  586, 550,  556, 552,  556, 1628,  584, 550,  556, 552,  556, 1626,  584, 1628,  582, 552,  552, 1632,  582, 1630,  580, 528,  580, 1630,  580, 1632,  580, 1630,  580, 1632,  580, 1630,  580, 1634,  580, 528,  578, 1634,  578, 528,  580, 528,  578, 528,  578, 530,  578, 528,  580, 528,  578, 530,  578, 1632,  578, 528,  580, 528,  578, 1632,  578, 1632,  578, 528,  578, 530,  578, 1632,  578, 530,  578, 1634,  578, 1634,  552, 556,  576, 532,  550, 1660,  552, 1660,  576};  // COOLIX B2BF4C
17:13:35.782 -> uint64_t data = 0xB2BF4C;
17:13:35.782 -> 
17:13:35.782 -> 
17:14:05.939 -> Timestamp : 000035.142
17:14:05.939 -> Library   : v2.7.12
17:14:05.939 -> 
17:14:05.939 -> Protocol  : COOLIX
17:14:05.939 -> Code      : 0xBAD34E (24 Bits)
17:14:05.939 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, Zone Follow: On, Sensor Temp: 19C
17:14:05.986 -> uint16_t rawData[199] = {4706, 4412,  556, 1684,  528, 578,  530, 1656,  554, 1684,  526, 1684,  528, 578,  554, 1656,  528, 582,  528, 580,  528, 1682,  528, 580,  528, 578,  526, 580,  528, 1682,  530, 552,  554, 1684,  528, 1684,  528, 1682,  530, 552,  556, 1680,  530, 578,  554, 552,  530, 1656,  554, 1656,  582, 550,  532, 576,  538, 1650,  578, 552,  532, 1656,  582, 1628,  586, 548,  534, 572,  558, 550,  558, 1628,  584, 548,  558, 548,  558, 1626,  586, 1626,  586, 1626,  586, 546,  562, 1622,  586, 548,  562, 1622,  588, 1622,  590, 544,  564, 544,  564, 540,  566, 1622,  588, 5206,  4770, 4350,  590, 1622,  590, 544,  588, 1596,  588, 1622,  588, 1624,  588, 546,  558, 1626,  586, 550,  558, 550,  556, 1626,  588, 548,  558, 548,  558, 548,  558, 1626,  582, 552,  558, 1628,  584, 1628,  582, 1630,  582, 552,  552, 1632,  580, 528,  578, 528,  578, 1630,  582, 1632,  580, 528,  578, 528,  578, 1630,  580, 528,  582, 1628,  580, 1632,  580, 528,  580, 528,  578, 526,  580, 1632,  580, 528,  578, 530,  580, 1630,  580, 1632,  578, 1632,  578, 530,  578, 1634,  578, 528,  552, 1660,  576, 1634,  576, 530,  552, 556,  576, 530,  554, 1658,  578};  // COOLIX BAD34E
17:14:06.079 -> uint64_t data = 0xBAD34E;
17:14:06.079 -> 
17:14:06.079 -> 
17:15:06.228 -> Timestamp : 000095.432
17:15:06.228 -> Library   : v2.7.12
17:15:06.228 -> 
17:15:06.228 -> Protocol  : COOLIX
17:15:06.228 -> Code      : 0xBAD64E (24 Bits)
17:15:06.228 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, Zone Follow: On, Sensor Temp: 22C
17:15:06.274 -> uint16_t rawData[199] = {4710, 4410,  584, 1654,  532, 576,  556, 1630,  580, 1654,  532, 1656,  580, 550,  556, 1654,  558, 550,  534, 572,  560, 1626,  584, 548,  560, 546,  560, 548,  560, 1650,  560, 548,  558, 1628,  584, 1626,  588, 1624,  584, 548,  562, 1622,  588, 546,  562, 1624,  586, 1626,  586, 546,  562, 544,  564, 542,  562, 1624,  590, 544,  564, 1620,  590, 544,  566, 542,  564, 1624,  590, 542,  564, 1618,  592, 542,  592, 516,  564, 1620,  590, 1622,  590, 1620,  590, 546,  564, 1620,  590, 542,  586, 1600,  588, 1620,  592, 544,  562, 544,  588, 518,  588, 1594,  618, 5182,  4734, 4382,  584, 1626,  584, 550,  554, 1628,  582, 1630,  580, 1630,  582, 530,  576, 1630,  582, 528,  582, 526,  580, 1630,  582, 526,  578, 528,  580, 528,  578, 1630,  580, 528,  582, 1632,  576, 1634,  580, 1630,  580, 526,  580, 1632,  578, 528,  576, 1634,  580, 1632,  552, 556,  580, 528,  576, 530,  578, 1632,  578, 530,  578, 1632,  578, 530,  578, 528,  578, 1636,  578, 530,  578, 1634,  550, 556,  554, 554,  576, 1634,  576, 1636,  550, 1660,  550, 558,  550, 1660,  552, 556,  552, 1660,  552, 1660,  552, 556,  576, 532,  560, 546,  576, 1636,  562};  // COOLIX BAD64E
17:15:06.366 -> uint64_t data = 0xBAD64E;
17:15:06.366 -> 
17:15:06.366 -> 
17:16:06.535 -> Timestamp : 000155.721
17:16:06.535 -> Library   : v2.7.12
17:16:06.535 -> 
17:16:06.535 -> Protocol  : COOLIX
17:16:06.535 -> Code      : 0xBADE4E (24 Bits)
17:16:06.535 -> Mesg Desc.: Power: On, Mode: 3 (Heat), Fan: 6 (Zone Follow), Temp: 24C, Zone Follow: On, Sensor Temp: 30C
17:16:06.535 -> uint16_t rawData[199] = {4706, 4410,  560, 1680,  528, 552,  556, 1682,  532, 1680,  530, 1680,  530, 576,  530, 1682,  530, 578,  530, 576,  530, 1682,  530, 578,  530, 552,  556, 574,  530, 1682,  532, 574,  558, 1654,  556, 1656,  530, 1680,  560, 546,  560, 1628,  582, 1652,  560, 1650,  560, 1626,  586, 546,  560, 546,  560, 546,  562, 1624,  586, 546,  562, 544,  564, 544,  562, 546,  560, 1650,  562, 548,  562, 1622,  590, 544,  562, 544,  564, 1648,  564, 1622,  588, 1620,  592, 544,  566, 1620,  592, 540,  566, 1618,  616, 1596,  588, 544,  564, 542,  566, 540,  566, 1618,  594, 5206,  4764, 4354,  586, 1626,  584, 550,  556, 1626,  584, 1628,  582, 1628,  582, 552,  554, 1630,  580, 530,  578, 528,  578, 1628,  582, 528,  578, 528,  580, 528,  578, 1630,  580, 528,  580, 1632,  580, 1632,  580, 1632,  580, 528,  578, 1630,  578, 1634,  578, 1632,  578, 1634,  578, 528,  580, 528,  580, 528,  578, 1634,  578, 528,  578, 528,  578, 530,  576, 530,  578, 1634,  576, 530,  560, 1652,  550, 556,  576, 532,  576, 1634,  576, 1636,  550, 1660,  556, 552,  550, 1660,  550, 556,  576, 1636,  550, 1660,  550, 556,  550, 556,  550, 556,  552, 1660,  550};  // COOLIX BADE4E
17:16:06.629 -> uint64_t data = 0xBADE4E;
17:16:06.629 -> 
17:16:06.629 -> 

I think that now all the work is done.
It was a real pleasure
Thanks

crankyoldgit added a commit that referenced this issue Nov 24, 2020
* Increase sensor temp range.
* using `setSensorTemp()` now correctly sets up ZoneFollow mode.
* ZoneFollow mode detection.
* Misc code cleanup.
* Refactor code to use bit fields.
* Additional & updated Unit tests.
* Add support for fan vane step commands.

Fixes #1318

* Confirmed working by user in #1318 (comment)
@crankyoldgit
Copy link
Owner

@fraschizzato Thanks for the confirmation. Sorry it took so long to resolve it all.

crankyoldgit added a commit that referenced this issue Nov 25, 2020
_v2.7.13 (20201125)_

**[Bug Fixes]**
- Fix crash when `IRac::sendAc(state_t, *state_t)` called with SAMSUNG_AC & `NULL` (#1341 #1339)
- Mitsubishi112 & 136: `setSwingV()` incorrectly sets mode. (#1337)
- Typo preventing RC6 from compiling when other protocols disabled. (#1332 #1331)

**[Features]**
- Coolix: Improve Sensor(ZoneFollow) and add Vane Step support. (#1340 #1318)

**[Misc]**
- refactor ir_Coolix (#1340)
- refactor ir_Mitsubishi (#1336)
- refactor ir_MitsubishiHeavy (#1333)
crankyoldgit added a commit that referenced this issue Nov 25, 2020
## _v2.7.13 (20201125)_

**[Bug Fixes]**
- Fix crash when `IRac::sendAc(state_t, *state_t)` called with `SAMSUNG_AC` & `NULL` (#1341 #1339)
- Mitsubishi112 & 136: `setSwingV()` incorrectly sets mode. (#1337)
- Typo preventing RC6 from compiling when other protocols disabled. (#1332 #1331)

**[Features]**
- Coolix: Improve Sensor(ZoneFollow) and add Vane Step support. (#1340 #1318)

**[Misc]**
- refactor ir_Coolix (#1340)
- refactor ir_Mitsubishi (#1336)
- refactor ir_MitsubishiHeavy (#1333)
@crankyoldgit
Copy link
Owner

FYI, the changes mentioned above have now been included in the new v2.7.13 release of the library.

@drschnalli
Copy link

Can i manage to send this sensor temp via irmqttserver example file? I modded my AC so its using outside air to cool its compressor... but now.... the AC shuts off when the outside temperature is below 17°C... so i want to emulate like 25°C so that the compressor will never stop.

@crankyoldgit
Copy link
Owner

By default, no. You will either have to send a pre-captured COOLIX message via the hexidecimal interface

The IRac interface doesn't support Sensors temps.

Of course, you can alter the code add what ever you like (yay for Open Source):
e.g. Add something like:
ac->setSensorTemp(25);
to:

/// Send a Coolix A/C message with the supplied settings.
/// @note May result in multiple messages being sent.
/// @param[in, out] ac A Ptr to an IRCoolixAC object to use.
/// @param[in] on The power setting.
/// @param[in] mode The operation mode setting.
/// @param[in] degrees The temperature setting in degrees.
/// @param[in] fan The speed setting for the fan.
/// @param[in] swingv The vertical swing setting.
/// @param[in] swingh The horizontal swing setting.
/// @param[in] turbo Run the device in turbo/powerful mode.
/// @param[in] light Turn on the LED/Display mode.
/// @param[in] clean Turn on the self-cleaning mode. e.g. Mould, dry filters etc
/// @param[in] sleep Nr. of minutes for sleep mode.
/// @note -1 is Off, >= 0 is on.
void IRac::coolix(IRCoolixAC *ac,
const bool on, const stdAc::opmode_t mode,
const float degrees, const stdAc::fanspeed_t fan,
const stdAc::swingv_t swingv, const stdAc::swingh_t swingh,
const bool turbo, const bool light, const bool clean,
const int16_t sleep) {
ac->begin();
ac->setPower(on);
if (!on) {
// after turn off AC no more commands should
// be accepted
ac->send();
return;
}
ac->setMode(ac->convertMode(mode));
ac->setTemp(degrees);
ac->setFan(ac->convertFan(fan));
// No Filter setting available.
// No Beep setting available.
// No Clock setting available.
// No Econo setting available.
// No Quiet setting available.
ac->send(); // Send the state, which will also power on the unit.
// The following are all options/settings that create their own special
// messages. Often they only make sense to be sent after the unit is turned
// on. For instance, assuming a person wants to have the a/c on and in turbo
// mode. If we send the turbo message, it is ignored if the unit is off.
// Hence we send the special mode/setting messages after a normal message
// which will turn on the device.
if (swingv != stdAc::swingv_t::kOff || swingh != stdAc::swingh_t::kOff) {
// Swing has a special command that needs to be sent independently.
ac->setSwing();
ac->send();
}
if (turbo) {
// Turbo has a special command that needs to be sent independently.
ac->setTurbo();
ac->send();
}
if (sleep >= 0) {
// Sleep has a special command that needs to be sent independently.
ac->setSleep();
ac->send();
}
if (light) {
// Light has a special command that needs to be sent independently.
ac->setLed();
ac->send();
}
if (clean) {
// Clean has a special command that needs to be sent independently.
ac->setClean();
ac->send();
}
}

Note: Sensor Temps normally need to be sent at regular intervals to the A/C in order for them to work. i.e. If the A/C doesn't see a sensor message in the last X minutes, it defaults to normal operation.

@crankyoldgit
Copy link
Owner

@drschnalli
P.S. Please don't add to an old closed issue (especially one that is 18+ months old). Create a new issue and reference the old one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants