Github Devices Community Docs Blog

Problems with controlling Haier AC using OpenMqttGateway

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




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 :

But the payload is too heavy for the default OMG setting:
You may calculate the size here :

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

And into platformio.ini

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

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:


when before I was getting something like this:


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…


Still nothing :confused: In serial monitor I get:

Hey I got a callback 
MQTTtoIR json
MQTTtoIR value || raw || datasring ok
Pub json into:
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:

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:

Wow great!
Now I need to update the docs and correct the issue with the protocols that have several variants.

No, you are great! :slight_smile:

But tell me, do you have any idea why value and hex do not work?

Also, to integrate it with Home Assistant (any thermostat control) I need to get all the possible states, modes, temperatures and build some kind of huge switch case/id statement, right?

Have you ever considered using state topic?

The value is too big to be handled currently, and the hex data was used only for a part of the devices (not HAIER AC), I have optimized the code so as to have a better handling of hex values, would it be possible to test it there:

With this type of payload:

Sorry for the delay, I kinda missed the message. Do you want me to test it (dev branch or sth) or wait for official 0.9.4?

If you can test the development branch of v0.9.4 it would be great !

Sure thing. I’ll try later today or tomorrow :slight_smile:

1 Like