Controlling AC by sending IR commands / checking if on or off

Good day everyone.

I am planning to have my arduino control our AC at home by sending the same commands the IR remote is sending. My problem is that, the ON/FF button is like a toggle. If AC is ON, pressing the button would turn it ON, when it is ON, then pressing the button would turn it OFF.

How would I know if the AC is initially ON or OFF? What would be best way?



Maybe the AC unit has separate on/off/toggle IR commands but the remote only uses toggle.
Try searching online the IR codes for your make & model of AC or maybe try sending all IR codes in the range your AC accepts and seeing what effect this has.

Another (hardware) option is to have some sensor to monitor if the AC is turned on. The sensor could be a current sensor module, a wind sensor, vibration sensor (for the AC fan) or even a light sensor to detect if the AC power on/off LED is lit.

You could cycle it off by a relay opening up the power feed. Then turn it on in about 5 minutes (time to allow the refrigerant to equalize) that would cause the internal controller to reset and turn everything off. I could be wrong but simply unplug it for a few minutes and see if it shuts down or remembers where it is. If you want to remove the cover connect a 1 wire sensor such as the DS18B20 to something to send you the status (if over ambient by about 25 degrees it is on). This one should be fun!