IRremoteESP8266 icon indicating copy to clipboard operation
IRremoteESP8266 copied to clipboard

IRHaierAC160 light toggle only working every 2nd time

Open dneuhaeuser opened this issue 2 months ago • 0 comments

I am using the IRHaierAC160 implementation with ESPHome and everything is working great so far, except the light toggle switch. currently it only changes the light status every 2nd press.

As is mentioned in the code this light setting is kind of special because it is only controlled by the button code (0x15) in byte 13. But the light button on the remote control works more like a pushbutton than a switch. Each time you press it, it sends the exact same code for switching the light on or off.

But the function setLightToggle sets the button depending on bool value to different codes. https://github.com/crankyoldgit/IRremoteESP8266/blob/61b43dea9726332c11ed6e26f0c4e7c95e9602f7/src/ir_Haier.cpp#L1776 I think this is wrong. It has to set _.Button = kHaierAc160ButtonLight every time.

Because of this the getLightToggle function unfortunately is useless here, because with this protocol there is no way of knowing the current state of the light. https://github.com/crankyoldgit/IRremoteESP8266/blob/61b43dea9726332c11ed6e26f0c4e7c95e9602f7/src/ir_Haier.cpp#L1769

dneuhaeuser avatar Apr 02 '24 23:04 dneuhaeuser