Hacking a Wi-Fi Air Conditioner with Raspberry Pi! Building a Fully Autonomous Smart Climate System That Learns Your Daily "Hot or Cold"
Freedom from Midnight Remote Struggles
On summer nights or winter bedtimes, have you ever woken up drenched in sweat thinking “27°C is too cold, but 28°C is too muggy…” and fumbled for the remote in the dark?
As smart homes have become common, simple automation like “turn on cooling when the room temperature exceeds 28°C” is easy to set up. However, human “comfort” changes subtly depending not only on room temperature, but also on outdoor temperature, humidity, and your daily physical condition or preferences. With simple threshold control, a human still ends up making fine adjustments in the middle of the night because something feels “not quite right.”
So this time, I controlled a Wi-Fi-enabled air conditioner directly from a Raspberry Pi and built a fully autonomous smart climate control system that learns daily “too hot / too cold” feedback and takes over midnight remote-control adjustments for me.
How the Autonomous Smart AC Works & “Morning Commute Feedback”
This system is not just a replacement for a remote control. Its defining feature is accumulating daily data and optimizing the target temperature specifically for you using a reinforcement-learning-like approach.
1. Thorough Data Logging Every 5 Minutes
A resident daemon runs on the Raspberry Pi, polling the air conditioner over Wi-Fi every 5 minutes for data such as “outdoor temperature,” “indoor temperature,” “current target temperature,” and “operating mode,” continuously keeping a rolling 12-hour log.
2. A Grid Recording the Optimal Solution per “State”
I prepared a “learning grid” that records the optimal target temperature for each specific state pair, such as “outdoor temp 28°C / indoor temp 26°C.” Whenever a matching grid entry exists for the current state, the system quietly adjusts to the optimal target temperature learned from the past while you sleep.
3. “Chat Check-in” & Learning on the Morning Commute Train (The Key!)
Every morning, around the time I wake up and ride the commuter train, the system asks via a chat app (such as Discord): “How was the air conditioner last night? (1. Comfortable / 2. Slightly hot / 3. Cold / 4. Muggy)”
When I reply from my smartphone with, say, “2. Slightly hot,” the system automatically looks back through the past 12 hours of logs. It identifies “the period when the outdoor temperature was highest and conditions were harshest,” and locally updates that specific grid cell’s target temperature by -0.5°C.
4. Automatic Prevention of Humidity Rebound (Mugginess)
Furthermore, it also calculates the “muggy feeling” caused when the room cools down and the AC switches to fan-only circulation. It integrates the gap between the target temperature and room temperature over time, and includes logic to automatically switch to “dehumidify (dry) mode” once a certain threshold is exceeded. If you answer “Muggy” in the chat, this switching threshold also learns to trigger earlier automatically.
Summary: A True Smart Home That Adapts to Humans
Instead of lowering everything uniformly by 0.5°C, repeating pinpoint adjustments like “lower the temperature slightly only when outdoor temp is X°C and indoor temp is Y°C” through morning commute chat check-ins creates, in just a few weeks, a reliable partner that lets you sleep soundly until morning without ever touching the remote at night.
Moreover, because all commands and log writes to this control system go through an internal local API, it is a clean, loosely coupled design where multiple programs never interfere with each other.
The era of wrestling with the remote every night is over. All the human has to do is share quick “feedback” on the morning train—and let the Raspberry Pi work through the night to maintain the ideal room environment!