Pages

Sunday, May 17, 2026

Controlling an Air Handler with Home Assistant.

In a previous post <Link>, I described how I put together a 'thermostat' using the EspBuilder integration in Home Assistant. That project was fun, but it relied on my old thermostat from years back that was actually wired into the Air Handler. Since I still have ties to actual code, and was familiar with Zigbee, I thought I'd put together a controller that directly wired into the actual Air Handler and lived on top of it up in the attic and out in the garage using the Arduino IDE. I saw this as a fun Zigbee project that I could tailor over time.

Sadly, that didn't work out. I started by creating a Zigbee device with one control, the fan. That worked well on the second try. I had the usual problem with setting it low instead of high. Then I added the reversing switch, that worked also. As I added things reporting and being controlled, I hit the magic number of seven. It seems the Arduino IDE Zigbee interface to the Esp Zigbee library had trouble with more than seven endpoints on a single device. That kind of sucks because to finish my plans for this new device I needed more than that. 

I thought about combining sensors by sending data encoded in numbers and such because text is a real pain using zigbee. Then I thought about my experience with EspBuilder. Maybe that would work...

There I was deep into YAML again, dropping into  lambdas of C code where necessary and spending hours looking for the exact right indentation needed to make this idea real. Coming from C originally, putting up with having indentation be the determining factor for nesting really is a space alien concept, but with the help of AI, I stumbled through it. 

I took a XIAO ESP32C6, another of those little expansion boards and a cheap four relay board and slapped them together.



I've learned that actually mounting things keeps the wires from one piece to another safer. I got really tired of hooking things back up and trying to keep track of pieces when prototyping. Now, all I had to do was wire up the relays, and using the EspBuilder code I had created, test this thing until I was comfortable that it might do the job.

So after some time with EspBuilder, I trotted this out to my garage where the Air Handler lives and used some sophisticated mounting devices to place it in actual operation.

Yes, duct tape

I just drilled a hole in the top of the Air Handler cabinet and stuck the device on top. It lived there for over a week taped down and actually doing its new job while I converted that AC unit over. I changed the device assignments in Home Assistant and disconnected the old DIY thermostat completely. Here's my previous thermostat that actually did everything resting in it's new retirement area:


That long USB cable was part of the actual installation. I would pull that out and plug it into my laptop to make code changes, then put it back inside the wall for next time. Notice the Arduino stack upper left? The model A Arduino, then the next layer is the ethernet board, then double stacked to allow for the ethernet plug to a board that held a buck converter to convert 24vac from the Air Handler to 5vdc for everything, and all the wires for the display, control buttons, and even the temperature sensor. 

Ah, the good old days ...

Of course there was wiring that had to be done inside the Air Handler. Have you ever looked inside one of those? They're a nicely laid out area where the factory put things together, then the place I needed to get to to connect my controls. On simple AC units, without fancy variable speed motors, semi intelligent control systems and such that we're starting to see, it's pretty basic. There are three controls, the fan, compressor and reversing switch. The reversing switch is what switches from heating to cooling by controlling which expansion valve is active, the one inside, or the one outside. Air conditioning is really simple until you get into the refrigerant handling. This is the wire bundle that leads out to the compressor beside the house:


The compressor and reversing wires are in there somewhere, "refer to schematic." Yeah, right, the schematic was wrapped around one of the covers and hard to follow, so I took pictures of each part, 




and then used paint.net to combine them, adding notes after I pondered each line to try and get the right ones hooked in:


My note boxes and complete schematic are now immortalized on Google Photos forever. When I get back into this thing in a year or two, at least I have some idea what I did last time. However, the actual Air Handler doesn't look anything like that. 


And, under the cover where the schematic wrapped around are the actual places that I need to hook to.



After a bit of following wires and installing connectors, I had it all wired up and tested with the prototype duct taped to the top of the box. I want folks to notice how I powered this device. 


Yes, it's a cellphone charger. I use these a lot for 5vdc projects. As I described in other posts, it's only a buck and will work just fine with 240vac input. Love these little things. Now, how to protect the boards and wiring. 


This is what I came up with. Yes, I ordered a new roll of white filament for the printer. I used plugs for both ends and kept the USB C connector as the power input. That way I can plug a laptop into that side to make changes if I need to do that. The other side is a Phoenix plug. I discovered Phoenix plugs mostly by accident prowling around for plugs on Amazon. You can put wires directly into both the fixed socket and the plug itself. Using plugs like this is really nice for environments where there is a small amount of vibration for a long time; plus it allows me to remove the entire assembly and bring it to a workbench for some work if needed. This is specifically what I used:


It looks like it's two parts, but it's actually three, One part mounts to the enclosure, and then the top piece snaps into that forming the socket. The plug part is one piece. I just put the wires from the Air Handler into the plug and the wires from the relays into the socket. It did take a bit of work on the enclosure to accommodate the mounting though. I put a recess in the enclosure using Fusion.


This worked really well, here's the test print I did to try it out



I was really proud of how well this worked. I printed up a lid for it that is just an inverted "C" that friction fits to hold it on since I wanted to get in there if something happened during extended testing and went live with it. 

It worked. 

Look, no more duct tape!

The "warm red glow" is the little lights on the relay board. Basically, I was done, so I just duplicated everything for the other AC unit on the north side of the house after this one proved itself for a week.

The last piece of this upgrade to my home controls is the remote temperature sensor, I'm still using the ancient ones I built up for the old system and waiting patiently for the Esp and Arduino developers to get past the bugs in their code. The last time I tried (about a month ago) two analog sensors wouldn't work in the Arduino IDE, one would show up in the other; I couldn't get two of them independently reporting. The ESP developers have promised EspBuilder would support Zigbee on the Xiao ESP32C6, but they encountered pretty serious problems with their build environment meshing with changes in Home Assistant. It is currently rumored that they blew off their first of the month deadline in favor of coming out with a 2026.6.0 release instead. So, both platforms are in flux and I'm currently stuck.

What I found though, was that EspBuilder under Home Assistant is really great for this kind of development. I can make changes, load them onto the device, and try them out from my recliner in the house. There is even a little web server on the interface board that I can get to.


There's a whole bunch of other features that make that development environment absolutely the best for home automation that fits it's requirements. 

Code? Sure, I will eventually put the code into github, when I feel a need to be punished learning yet another new thing.

No comments:

Post a Comment