Thank you. Now this part is fixed but I think there is still some issue with long numbers as the codes that fit in a signed long works but no the bigger numbers that need unsigned long.
When I send the code -> Hex: 7E817E81 (decimal 2122415745) it works fine.
When I send the code -> Hex: 807F817E (decimal 2155839870) it doesn’t work. And according to AnalysIR this is what is sent:
When you receive this code via mqtt transceiver - how mqtt message and topic looks like ?
May your device have different bit-lenght? I forget about it - see new code. Note that I didn’t check it yet.
I’m sorry I do not have an IR detector connected to my ESP8266.
I think the issue may be within the IRremoteESP8266 library as I just tested and same problem happens with the original IRSendDemo sketch included with the library. I just opened an issue here: https://github.com/markszabo/IRremoteESP8266/issues/27
According to AnalysIR the bit-lenght is always 32bits. You can see here some random keys of the remote pressed captured and analysed by AnalysIR:
I changed the irsend.sendNEC(msgInt, irBitsInt); line in the code and it looks better (I closed the issue as I had a similar mistake in my testing with the IRSendDemo sketch.
I’m still receiving a wrong code (when I send 807F817E I receive 7E81FE01). It looks similar and partially reversed, don’t know why (is swaped as: ABCD => DCxx.
I’m really tired. After most of the day testing different things I still don’t know what’s going on.
I added a IR receiver to the ESP8266 and it gives me the same code AnalysIR does but looks like some times it works and some times dons’t. Also some codes works fine 100% of times and some others almost never.
Many times the start bit (should be around 9us) has a gap, always at the same position (like 5us high, 2us low and 2us high.
I tried different sketches, different hardware and also visualized the IR signal with an oscilloscope.
I’m going to rest and will continue tomorrow or the weekend.
Try test with simple code on Arduino hardware and just transmit your codes. I’m afraid that ESP implementation of IR library is not so good as for Arduino. Unfortunatelly I can’t test because I don’t have device with problems.
Looks like the problem I had is only with certain IR codes, so I just avoided them. Fortunately all the codes I need for what I want to do with my Yamaha receiver are working now.
Thank you very much for your code. It’s fantastic!