Problems with controlling Haier AC using OpenMqttGateway

I was finally able to get back to Home Assistant and the whole AC control using OMG. I just flashed latest version (0.9.3) on my Wemos D1 with IR shield and I’m afraid there is still something wrong. I know that Haier unit is now supported, but I still am unable to get it to work, mainly send commands. I am also kinda not sure about the data I am getting.

I press On/Off button on the remote, on

home/OpenMQTTGateway_ESP8266_IR/IRtoMQTT

I am getting:

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

I send to:

home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR

message:

{"value":2314393241143126182,"protocol_name":"HAIER_AC_YRW02"}

In VS Code, in Terminal I see:

Hey I got a callback 
MQTTtoIR json
MQTTtoIR value || raw || datasring ok
MQTTtoIR OK
Pub json into:
home/OpenMQTTGateway_ESP8266_IR/IRtoMQTT
{"value":2314393241143126182,"protocol_name":"HAIER_AC_YRW02"}
Hey I got a callback 
Store str
Min ind:
4
store code :
15116454/2317181
Col: val/timestamp
0:15116454/2120869
1:15116454/2165606
2:15116454/2202061
3:15116454/2295565
4:15116454/2317181
5:15116454/979443
6:15116454/998437
7:15116454/998478
8:15116454/1015877
9:15116454/1015973
10:15116454/1103441
11:15116454/1116997
JSON str
Creating IR buffer
Rcv. IR
636,3198,664,208,632,266,608,262,632,208,660,210,634,266,628,208,662,208,634,250,660,260,634,258,628,262,634,234,626,258,632,258,632,258,660,232,664,258,632,258,630,260,630,234,632,256,636,254,634,256,636,3640,664,258,630,262,632,260,634,230,658,234,628,258,634,258,662,234,654,232,662,258,632,260,632,232,632,256,632,256,636,254,634,13202,662
--no pub unknwn prt or data to high--

And after some time I get messages like this:

Rcv. IR
664,3158,634,234,662,208,634,236,632,268,632,236,632,206,634,240,630,266,632,250,632,230,632,258,634,256,636,256,662,230,658,260,632,260,632,256,606,256,632,256,638,252,634,256,634,256,662,260,630,260,632,3608,662,232,660,260,636,228,658,232,660,230,632,256,634,258,660,228,662,260,636,254,632,260,630,262,630,230,632,258,634,260,660,13214,636
--no pub unknwn prt or data to high--

I’m kinda confused. Only additional modification is as per suggestions in this thread I increased kRawBuf from default 100 to 300 since my Haier unit sends 112 bits.

Hi,

try to send the hex value with the protocol_name like that:
{"hex":"0xA6A8E60064601E201E0000000559","protocol_name":"HAIER_AC_YRW02"}

Tried that, nothing happens. I see the message correctly published to commands/MQTTtoIR but the AC does not respond/react.

I did replace this:
IR_EMITTER_PIN 16
with
IR_EMITTER_PIN 0
since I’m using Wemos D1 mini wih Lolin IR shield.

I used my phone camera and when I publish the command I see the emitter leds blink, so there has to be something with the payload.

Could you post what does the serial monitor say please?

How far are you from your air conditioning?

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

Then after a while

Creating IR buffer
Rcv. IR
336,592,312,4118,452,370,338,3214,88,1144,172,336,246,4650,78,316,432,3264,118,6178,86,816,228,3062,236,1958,142,254,224,1666,470,1410,124,1452,336
--no pub unknwn prt or data to high--

after another while

Creating IR buffer
Rcv. IR
440,3312,474,1358,404,344,106,788,408,834,130,366,538,278,530,422,474,366,96,208,182,424,466,396,442,1284,364,652,264,684,280,482,140,782,246,812,246,450,390,834,164,444,474,492,370,672,220,422,498,4684,472,456,446,332,226,742,506,396,274,590,468,436,512,502,360,340,384,838,218,476,414,422,430,460,440,834,116,416,450,13408,414
--no pub unknwn prt or data to high--

and after another while

Creating IR buffer
Rcv. IR
416,3534,412,374,246,590,450,494,458,468,236,536,500,576,262,748,120,592,334,782,56,566,226,550,160,788,372,404,260,786,134,528,528,546,388,614,124,792,264,418,280,556,530,338,304,1560,166,804,362,4120,122,440,88,338,70,404,246,616,470,784,172,330,440,928,64,452,280,592,272,588,244,618,500,328,310,880,290,418,136,844,218,14532,414
--no pub unknwn prt or data to high--

And it goes on like that.

Distance is no issue, I’m around 1-1.5m from it :wink:

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.