Github Devices Community Docs Blog

Problems with controlling Haier AC using OpenMqttGateway

Do you have another receiver with a second board to see if you receive what you are sending?

Good idea! I got another Wemos, I’ll try tomorrow and report back.

1 Like

I’m not getting anything. I used NodeMCU with IRrecvDumpV2 and I am not getting anything when I publish the message to the topic. I’ll try to flash Wemos with IRsend or something…

1 Like

@1technophile Any more tests or debug info I can provide?

When flashing with IRsend did you get it working ?

I was able to send RAW with flashed IRsend:

uint16_t haierRawData[229] = {2962, 3074, 3016, 4380, 596, 1588, 572, 580, 596, 1642,
570, 582, 572, 580, 570, 1614, 570, 1614, 570, 580, 568, 1642, 570, 606, 544, 1614,
570, 556, 594, 1616, 568, 1618, 592, 582, 570, 582, 570, 1614, 570, 1612, 572, 1616,
570, 1642, 594, 582, 568, 582, 570, 1614, 570, 580, 594, 558, 596, 582, 568, 606, 542,
582, 596, 556, 570, 580, 568, 584, 592, 582, 572, 580, 570, 1616, 570, 580, 572, 578,
570, 580, 570, 608, 570, 580, 570, 582, 570, 578, 572, 1616, 570, 1616, 570, 584, 594,
580, 572, 580, 570, 582, 570, 582, 568, 584, 566, 582, 596, 592, 542, 580, 570, 584,
594, 580, 572, 578, 570, 582, 570, 580, 570, 582, 596, 1592, 592, 580, 570, 582, 570,
582, 568, 580, 570, 582, 570, 606, 568, 582, 570, 582, 570, 580, 596, 556, 564, 584,
570, 558, 594, 606, 570, 584, 594, 556, 566, 582, 570, 582, 596, 578, 570, 582, 594,
582, 542, 582, 596, 556, 568, 580, 570, 582, 568, 606, 594, 558, 570, 582, 570, 580,
568, 584, 570, 590, 592, 558, 568, 582, 568, 608, 542, 610, 570, 580, 570, 582, 570,
608, 542, 584, 568, 584, 592, 580, 570, 582, 568, 582, 568, 1616, 570, 582, 570, 1616,
568, 610,568, 582, 594, 558, 564, 582, 570, 1616, 572, 580, 568, 608, 568, 1618, 488};
irsend.sendRaw(haierRawData, 229, 38);

couldn’t send hex/value, but probably because using the wrong method or values were wrong:

unsigned char m_Test[112] = "0xA69CF200406000200000000005F9";
irsend.sendHaierACYRW02(m_Test, 112, 1);

And you successfully controlled your AC with raw values?

I tried IRsend and it was fine with the code I posted.

When I try that from OMG, I am publishing this payload

{"raw":"2990,3074,3016,4376,574,1612,570,582,594,1618,564,582,572,580,596,1590,594,1592,568,606,568,1616,570,580,572,1614,570,1614,568,1616,570,1616,622,556,572,578,568,1616,568,1616,566,1642,568,1618,568,582,570,584,540,1666,542,584,570,610,542,606,570,582,570,580,572,580,544,636,542,554,568,610,594,578,570,1618,568,584,568,580,568,582,570,584,592,582,570,582,568,580,570,1616,570,1590,596,608,540,608,570,582,568,580,594,532,594,582,568,582,570,582,594,608,542,582,570,584,568,580,568,584,566,584,570,608,570,1614,570,606,542,582,568,584,570,578,572,582,596,608,544,580,594,558,590,558,572,580,568,580,570,608,570,578,572,580,570,582,568,580,568,584,594,582,568,582,570,582,570,580,568,582,568,584,566,608,570,584,568,582,594,558,570,606,542,582,570,606,570,582,570,584,568,600,542,582,568,610,566,582,570,584,594,580,542,584,570,632,518,608,570,584,568,1644,540,582,596,1566,594,584,566,582,620,582,540,1622,590,1618,544,584,594,560,566,1642,490","protocol_name":"IR_Raw"}

To

home/OpenMQTTGateway_ESP8266_IR/commands/IR_Raw

And I get nothing, on the AC and in the terminal monitor in VS Code.

Let me try it with my setup

You should try to :
home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR

But the payload is too heavy for the default OMG setting:
You may calculate the size here : https://arduinojson.org/v6/assistant/

To change the setting go to user_config.h at line 279 and replace:
#define JSON_MSG_BUFFER 512
by
#define JSON_MSG_BUFFER 1280

And into platformio.ini
MQTT_MAX_PACKET_SIZE=1024
by
MQTT_MAX_PACKET_SIZE=1280

And the gateway should be able to handle such a big raw array:

N: Received json : {"raw":"2990,3074,3016,4376,574,1612,570,582,594,1618,564,582,572,580,596,1590,594,1592,568,606,568,1616,570,580,572,1614,570,1614,568,1616,570,1616,622,556,572,578,568,1616,568,1616,566,1642,568,1618,568,582,570,584,540,1666,542,584,570,610,542,606,570,582,570,580,572,580,544,636,542,554,568,610,594,578,570,1618,568,584,568,580,568,582,570,584,592,582,570,582,568,580,570,1616,570,1590,596,608,540,608,570,582,568,580,594,532,594,582,568,582,570,582,594,608,542,582,570,584,568,580,568,584,566,584,570,608,570,1614,570,606,542,582,568,584,570,578,572,582,596,608,544,580,594,558,590,558,572,580,568,580,570,608,570,578,572,580,570,582,568,580,568,584,594,582,568,582,570,582,570,580,568,582,568,584,566,608,570,584,568,582,594,558,570,606,542,582,570,606,570,582,570,584,568,600,542,582,568,610,566,582,570,584,594,580,542,584,570,632,518,608,570,584,568,1644,540,582,596,1566,594,584,566,582,620,582,540,1622,590,1618,544,584,594,560,566,1642,490","protocol_name":"IR_Raw"}
    N: Raw: 2990,3074,3016,4376,574,1612,570,582,594,1618,564,582,572,580,596,1590,594,1592,568,606,568,1616,570,580,572,1614,570,1614,568,1616,570,1616,622,556,572,578,568,1616,568,1616,566,1642,568,1618,568,582,570,584,540,1666,542,584,570,610,542,606,570,582,570,580,572,580,544,636,542,554,568,610,594,578,570,1618,568,584,568,580,568,582,570,584,592,582,570,582,568,580,570,1616,570,1590,596,608,540,608,570,582,568,580,594,532,594,582,568,582,570,582,594,608,542,582,570,584,568,580,568,584,566,584,570,608,570,1614,570,606,542,582,568,584,570,578,572,582,596,608,544,580,594,558,590,558,572,580,568,580,570,608,570,578,572,580,570,582,568,580,568,584,594,582,568,582,570,582,570,580,568,582,568,584,566,608,570,584,568,582,594,558,570,606,542,582,570,606,570,582,570,584,568,600,542,582,568,610,566,582,570,584,594,580,542,584,570,632,518,608,570,584,568,1644,540,582,596,1566,594,584,566,582,620,582,540,1622,590,1618,544,584,594,560,566,1642,490
N: MQTTtoIR OK

Ok, we’re getting somewhere. I was able to send raw after the changes. So I wonder what’s wrong with hex values.

Also I really don’t know…I think I need to reflash clean from scratch because now I am not receiving decoded messages as before on button presses. I reverted the changes you suggested but it’s the same.

Also while I like Platformio and that I can edit everything in VS Code I use on daily basis…the issues with unknown identifiers in *.ino files is just a pain…

Just to add…I tested with another Wemos ans it started to get the codes. And after your proposed changes, I am also getting the ‘raw’ part like so:

{"value":2305948837223771302,"protocol":44,"bits":112,"hex":"0xA6ACF20040600020000000000509","protocol_name":"HAIER_AC_YRW02","raw":"2934,3128,2984,4384,568,1622,564,612,536,1620,588,588,566,586,562,1622,538,1648,564,714,460,1674,514,560,590,1620,564,614,532,1594,592,1700,486,588,590,588,558,1754,432,1680,506,1598,590,1646,564,562,588,590,558,1676,510,590,564,588,536,664,510,564,590,614,558,588,564,588,538,668,536,558,566,588,562,1622,564,644,518,584,562,664,512,588,564,588,536,662,518,610,538,1620,564,1648,566,634,516,584,564,614,532,588,566,586,540,692,508,614,538,588,538,662,512,586,566,614,536,636,540,588,564,614,532,588,566,1646,538,588,538,664,536,588,566,614,534,614,538,588,564,590,592,530,616,590,558,614,590,628,512,586,564,668,480,616,540,588,562,640,508,614,540,640,510,664,512,586,564,590,562,582,568,586,562,642,532,616,538,588,562,590,560,612,540,614,538,628,540,588,590,582,540,586,566,668,506,588,564,588,564,636,538,562,564,616,534,642,538,586,538,696,478,1654,534,588,564,1620,564,614,558,590,564,590,560,560,592,1646,538,588,564,616,556,1648,460"}

when before I was getting something like this:

{"value":2314393241143126182,"protocol":44,"bits":112,"hex":"0xA6A8E60064601E201E0000000559","protocol_name":"HAIER_AC_YRW02","raw":}

Still can’t send by value or hex though…

Also…it drives me nuts that some of the options set in the user_config.h or platformio.ini do not seem to be reflected in the flashed image. Like I set the gateway name to ‘something’ and it’s still says omg…also there is no variable for version, all the small things, argh :wink:

May you detail that?

Yes the increase of payload capacity enable to receive bigger values, we should have something about that to the docs.

Do you mean that if you flash OMG to the ESP it will keep the previous gateway name by wifi manager ?

Let me test this

Found the issue, the program send it with HAIER_AC before sending it with HAIER_AC_YRW02…

I have found an issue with the protocol identification method
if (strstr(protocol_name, "HAIER_AC") != NULL)
should be
if (strcmp(protocol_name, "HAIER_AC") == 0)

But there is maybe other thing. I will investigate.

I meant all the errors that VS Code reports and still the project builds:


It seems it’s looking for header files in “*/OpenMQTTGateway/include”, at least that’s the path added to c_cpp_properties.json in .vscode folder and this path does not exist. It adds */main as well, where all header files are but it’s missing lib ones I believe, because those are in .pio/libdeps.

I mean that even if I set Base_Topic variable it set’s it I don’t know from where, the current one I’m flashing has home, the fresh one I flashed had ‘omg’…I’m confused…

Code_F3TX0vHcIm

Still nothing :confused: In serial monitor I get:

Hey I got a callback 
MQTTtoIR json
MQTTtoIR value || raw || datasring ok
MQTTtoIR OK
Pub json into:
home/OpenMQTTGateway_ESP8266_IR/IRtoMQTT
{"hex":"0xA6BCF20040600020000000000519","protocol_name":"HAIER_AC_YRW02"}
Hey I got a callback
Store str

Thanks for all the help and spending time to debug this with me! :+1:

I will take a look

The Base_Topic is overridden by the flash setting if there is one, currently if you want to change it you need to use wifimanager or do an erase flash before uploading.

Oh, didn’t know that. Maybe I just should use Wifi Manager then.

I wonder if there is a better way now, I’m still using it like old days, making changes in user config but now, with OTA and all maybe I should change approach.

Once this modification done at line 713 could you try to send your hex data like that:
{"datastring":"A6,BC,F2,0,40,60,0,20,0,0,0,0,05,19","bits":14,"protocol_name":"HAIER_AC_YRW02"}

Yeah! It beeped! I don’t know why others didn’t but this worked! Man oh man, I’m confused why there is so much hustle with Haier. I feel like noone has so many issues with the gateway and their AC as me :slight_smile: