Problems with controlling Haier AC using OpenMqttGateway

Now that I think about it, I would remove the whole 20 bits block. I don’t think it makes sense since it will never be hit, right?

It could be useful to remove it for the base SONY protocol if other users confirm that SONY protocol is always 12 bits. In this case I will also propose a PR into IRRemoteESP8266 repository.

I’m not saying to remove it from being able to handle 20 bits. I just mean that those logic statements are wrong in a way that the second one will never be hit, because if valueBITS is 0, it will be set to 20 (in the current code) and the second if statement will be always false.

So there are two things wrong there, we changed what is the default for Sony protocol (from 12 to 20 by doing a check for 20 first) and we make an if statement that will never trigger. That was my point, not like removing it from IRRemoteESP8266 repo.

The second ones is hit when you are not on ESP32/ESP8266 platform, there is a
# if defined(ESP8266) || defined(ESP32)
above.
When we are on arduino we use a different library for IR with a default value of 12 bits.

Ah, so yes, makes sense. Didn’t know that.

Supporting several boards makes the code a little bit harder to read :slight_smile: