While there are plenty of smart devices to control central heat and air conditioning, these will not usually work with portable units. Using a Raspberry Pi with a few simple electronics, I was able to upgrade the control of my window A/C unit.
At a minimum, I wanted to turn the A/C on and off from my phone. This is nice at the end of the day when I go to bed and realize I left the A/C running from the other end of the house. A remote control was included with the A/C unit but the range is obviously limiting. By coupling an infrared receiver to my Raspberry Pi, I was able to teach the Pi the infrared signals from the remote using an open source Linux package — LIRC. Then I connected an infrared transmitter to the Raspberry Pi to relay those same signals such as Power, Temperature +/-, Mode, etc… That could allow the unit to be controlled from anywhere.
While sending the remote control’s commands is useful, it also would be helpful to know whether the unit is on or off. For this I attached a vibration sensor that will notify the Pi when any vibration is detected in the last 5 seconds, which will be interpreted as the A/C is running.
This setup allows the Pi to communicate with the A/C unit, but I needed to communicate with the Pi. I opted for an Apple Shortcut that sends SSH commands to trigger the individual scripts. This is not the most elegant interface but it does the job.