back
170 comments
The "couple a stepper motor to a shaft" API is so much better than any "smart" appliance API.

Speaking more seriously, I wish classes of appliances would expose some simple analog and digital interface pins in a standardized configuration to let users choose whatever automation or monitoring hardware they want. HVAC equipment does this with standardized thermostat terminals. I'd love to see that on other types of appliances, too.

The manufacturer's crappy "app" that will inevitably be abandoned and require keeping some old phone / tablet in good "health" lest you lose the "smart" functionality (or worse, any use of) the appliance.

Then current way of putting the "smarts" inside the appliance is just planned obsolescence and a recipe for all of us being eyeball deep in ewaste.

It always kind of blows my mind that I keep seeing "smart TVs" which have a bunch of integration options for high-end AV installations (rich people's houses, etc.) but no API that you can integrate with to just handle toggling channels/inputs/power states/volumes.

(I did get my last Sony Bravia integrated with Homekit so that I could control inputs, volume, etc. via the Home app, but that's not really what I'm looking for).

Give me an HTTPS API, require me to authenticate devices on the TV itself before it accepts their commands, and just let me do whatever. Default it to off and make it a hidden setting, but yeah just let me do the thing without having to pay tens of thousands of dollars for some professional installation to integrate with hardware I don't have and can't afford.

Exactly.

I don't want a "smart" washer / dryer / fridge / toaster. I want a standard interface I can build my own system around, or use someone else's that they've already built.

>HVAC equipment does this with standardized thermostat terminals.

yes, they standardize thermostat terminals, but they should allow additional inputs such as a measure of radiant heat entering through the boundary surfaces. I have to change my thermostat far more because it's a sunny day than I need to because of different outdoor temperatures. Bear in mind, I shouldn't have to change my thermostat at all† (except perhaps between summer and winter)

† perhaps my biggest pet peeve, and I have many, is that 99% of the population—including engineers from top universities—believe that if you feel warm you should imediately max-out your A/C thermostat, and when you get cold you should shut it off. It's a thermostat, its job is to turn on-and-off to maintain a temperature. I never touch the one in my car and it works great. (as mentioned, I need to change the house thermostat, see solar radiance‡ above)

‡ I once had the pleasure to work with a great mechanical engineer, he designed climate systems for art museums and other public and billionaire buildings, and I described my radiant heat problem and he said "that would be super advanced, I've never heard of any systems that do that."⹋

⹋ another one of my pet peeves is footnotes. In general, they require a massive context shift, as if it's not a problem to keep your place while you look in another place. But notice how I've threaded mine so they do not require congnitive leaps.

>HVAC equipment does this with standardized thermostat terminals.

The industry hates this and wants it gone because they want you locked into buying the rest of the stack from them and they want you shelling out $$$ for emergency repairs rather than jumpering it when it fails at a bad time.

What I want instead is for devices to ship a (tiny) HTML/JS control panel (or its hash if ROM space is limited), using some specialized interface to make requests over BLE or a relay chosen by the user.

The reason we need an app in the first place is 1) customizability, 2) ability to access the device even when out of WiFi range, even when behind carrier-grade NAT and/or a restrictive firewall. A design where the device hosts a simple "server" that makes an outbound connection to a proxy of the user's choosing, likely provided by their smartphone vendor, to receive requests would solve both problems.

When I had a kitchen fire, I told my electrician "no smart stuff" and he was happy to go along. (I had very little previously.) He did simplify and updated my electrical panel and switches which sort of accreted over time.
Nowadays it's surprisingly easy to vibecode replacements to some shitty OEM apps (and fix bugs while you're at it). I've had pretty good luck with BT devices, even ones that dont use standard GATTs
Many smart meters have an LED that blinks every time you consume a watt-hour.
This is what drives me to sometimes DIY devices instead of buying them. There is so much crap on the market and it gets increasingly hard to tell where the catch is. Does it only work with the manufacturers weird cloud? Which feature(s) do work without? What settings are even possible?

Really simple appliances can be very hard to find, e.g. a desk fan that can be set to spin very slow. Most fans have 3 or 5 speed settings and the lowest is already tenfold too high for my taste. Solution? Get the dumbest fan you can find and speed control the motor yourself.

It's insane to me that some new construction buildings still use PTACs. Having used too many of those, this was a deal-breaker last time I was in the market for an apartment. Such a New York thing, just like how you cannot have a balcony on the 2nd floor, or how you won't find those sink garbage disposal grinders in any kitchen. But cross the Hudson toward NJ, and my understanding is that they're common. It's a combination of hyper-local regulations and economic incentives that date from god-knows-when and make American cities very unique in their quirks.
PTACs suck. Well-maintained, newer models suck less, but they still suck. Unless well-insulated, the sleeves leak air (and humidity). And there's a duopoly between Ice Air and Islandaire, so they get to charge more for maintenance. They benefit from the trend of maintenance for older models being a yearly chore also.

From what I understand, PTACs started as a convenient way to retrofit apartments with air conditioning. You don't need ductwork, which I believe is more expensive in the concrete buildings around here. Also, I think you need protected refrigerant sleeves to meet code here, but only if the sleeves go from one floor to another (someone just told me this fact today, and i haven't verified this).

BTW that PTAC's thermostat dial in the link doesn't have numbers around the dial, which I think is honest. No A/C unit I've ever owned has managed to have a thermostat that read the temperature I was feeling consistently. It makes me think the apartment was built before the late 2010s though -- still feels new but a generation ago in HVAC terms. Mini-splits seem to have arrived, even for <1M condos. Talking to the mini-split contractors I had over recently for a squeaky noise, I got the feeling that business was booming. They had every day in the summer booked months in advance.

Garbage disposals were at one time illegal, and despite the passage of 30 years there’s still concern in existing buildings that the plumbing can’t handle it (which is probably unfounded).
https://esphome.io/ would make the software side of this a 10 minute job
If all you need to do is replace a potentiometer with electronic control, it may be possible to do that with a vactrol. It's more invasive perhaps, but then we're not dealing with anything mechanical.

A vactrol is a device which combines LED and photoresistor in one package (sealed against the leakage of light).

The photoresistor has a "dark resistance" that is typically very high, like hundreds of thousands of ohms. When it is illuminated by the LED, the resistance goes down: you control how much via the current to the LED.

Another possibility is using a digital potentiometer, like this: https://ww1.microchip.com/downloads/en/DeviceDoc/20005207B.p...

A digital pot is an integrated circuit that switches a bank of resistors with FETs to create a desired resistance, or combination of resistances to simulate a wiper position along an analog pot's track.

They are programmed with I2C and such.

These things have certain disadvantages; like the one I linked to requires that power rails be provided for the analog domain where the resistors "live", and the voltages on them must be within this range. The vactrol has no such issue; it is a passive resistor with light shining on it.

Since you hooked it up to Home Assistant anyway, I think you could have skipped the custom firmware and just used ESPHome with a Button component https://esphome.io/components/button/
> Imprecisely yeet the stepper motor all the way left/right, toggling the target temp between “really really hot” or “really really cold”

> Option 2 certainly is the “jankier” of the two options, given that it relies on a second-order property (target temp) to power the unit on/off… but hey - whatever’s easier, right?

Isn't this basically how a thermostat works? I.e. there is a component that is binary on/off, and a thermometer is used to decide to switch on or off.

> The rest of this blog post is a walkthrough of a software engineer’s approach to home automation and building custom hardware, and let me tell you: both the final product, and the journey to get there, are hella jank.

IMHO it's not that bad? With the disclaimer that I'm also a software engineer who dabbles very very lightly with electronics and has no mechanical engineering expertise. But the overall approach of doing this by stepper motor seems quite defensible given the security deposit constraint. The only part that seems really janky to me is that it's not physically held in place that well as noted in this paragraph:

> Ultimately, the biggest issue is that binder clips and cardboard aren’t quite as robust of a mounting mechanism as I’d hoped they’d be… and over time, the stepper motor tends to “sag” a bit, resulting in a bit too much friction between the motor, the coupler, and the underlying knob, causing the mechanism to stall out until someone manually goes and reseats it…

Involving MQTT and HA can sometimes get frustrating too; having your AC not working properly if there's a problem on a Linux machine can suck. If this becomes a problem in practice, iirc ESPHome also has a thermostat component, and temperature sensors are really cheap and easy to wire in, so you could do it all on the microcontroller pretty easily in a low-code way. But if this part is working, no need to mess with it.

Instead of attaching the motor bracket with a binder clip, consider sticking it down with some sort of removable adhesive?

3M command strips should be very strong/secure, while also allowing for adjustment and will detach without residue when the time comes.

I've wired ESP32s into all my old heat pump units using ESPHome. They are more reliable and more responsive than the $400 dongle they sold with newer units.
Maybe not as fun but my sun room window unit is controlled by an off the shelf $20 thermostat designed for Air Conditioners. It’s the LUX Win 100 and is date/time programmable and features a compressor lockout so it doesn’t burn out your window unit by short cycling.

If you have a favorite smart thermostat you could also wire up a receptacle with a contactor between it and a cord and a 24v AC transformer wired to the line side. This would make your window unit controllable just like a central air conditioner.

I don't understand why he can't just connect / disconnect the power? The thermostat is a bi-metallic strip.

Assuming the thermostat is controlling 120V AC:

1: There are plenty of cheap wireless thermostats for AC that you can buy off of Amazon. I have two, and they work great with space heaters.

2: You can use a 120V relay with those thermostats to control different voltages, amperages, ect.

---

BTW, controlling the dial for min cool, max cool, ect, could increase efficiency. Max cool is only needed if the unit's been off, or it's a super-hot day.

These articles, over and over again, are what have made Hacker News one of my regular go tos for amazing ideas and creative ingenuity.
The more I mess around with ESP32s and home automation, the more I realize that was looks like jank to a software engineer is just the way these things work.

Look at the MAC addresses of smart devices connected to your home network and 90% of them are just going to be ESP32 chips hooked up in this way to some control mechanism, but in a nicer enclosure.

that's a fun project. i'd be a little concerned about the servos failing to fully switch the switches or placing wear on them, maybe a dangerous failure mode where it is switched into and left in an in-between state unattended that could lead to a fire hazard.

you can buy smart outlets with the correct connector, just look for 20A versions. (honeywell, at a minimum, sells one).

https://prod-edam.honeywell.com/content/dam/honeywell-edam/h...

I was in a similar situation with my apartment PTAC unit, but mine has thermostat terminals — I would not be surprised if this one does too. I was able to hook up an Ecobee thermostat, with the downside being that it's way more expensive than OP's solution.
> so it took a few Amazon returns until I found the right one

This a pet peeve of mine. If you buy the wrong $2 part don't return it. If you don't eat the loss the seller will and the part will wind up in the landfill.

I have to say. Nice work. I spent years wanting to build something like this to integrate to these systems. I never did but have spent years thinking about this. So, nice work and really appreciate your motivation.
Oh, hey, I'm the author!

Happy to answer any questions :)

Damn. I have wanted to do the same at my place for years (also in NYC). He beat me to it. I also can’t just use a smart plug. Unfortunately I only have one knob, it has four positions (and is open anywhere between), and requires a good amount of torque to move. I’d need to gear down the stepper and figure out a way to detect when it’s in the correct position (maybe an encoder, maybe current sense to ‘feel’ when it’s reached a close position?)
I don't get how so many large buildings in NYC and Beijing (two cities that I've personally visited) use independent little AC units like the PTAC or minisplit types. A couple per apartment, peppered over the outer walls. Engineers intuition says surely a large central unit would be more efficient and effective.

Is it because of personal ownership reasons? Counterintuitive physics? Heat dissipation limitations on the roof?

Can someone with more knowledge clue me in?

Here I was all proud of myself for controlling my Mitsubishi AC via CN105 connector using pure ESPHome and this guy does this great hack! Good job!
OT: I'm looking for some way to control my AC via Infrared. I have a few pretty standard AC units with IR remotes. The ones with a display on it, that just transmit all the settings on the remote via IR on every button press.

Some device I can mount in proximity, that controls the AC, but preferably also has a temperature and humidity sensor included.

I turned mine smart by using an esp32, an IR led and a n ir demodulator. The esp32 has the ir led pointed towards the AC and the receiver aimed at the room. It then hosts a small html page and connects via wifi to my home network. It used the receiver to sync its internal state, if the actual remote controller was used.
As a renter myself, I get the author's pain. I ended up just installing this non destructive retrofit switch for most of my home automation + smart bulbs.

[1] https://www.thirdreality.com/products/smart-switch-gen3

A friend of mine has the same problem with his, but his AC unit doesn't have knobs but rather has touch sensitive buttons (those ones where a finger is required). Any ideas how we might get around controlling that one?
You need to 3D print a bracket. That's what will give you the last 10-20%.
I'm pretty sure doing janky things to the AC you don't own is a lease violation.

I'd gladly let them keep the security deposit so that evil companies like RealPage don't blacklist me.

Assuming running a dual hose inverter portable AC isn't against the lease agreement it would probably pay for itself based on the power usage. Pretty neat hack regardless.
I think the crank the temp hard one way or another is a fairly common approach. It’s what I do to have home assistant use my nest thermostat as a dumb switch.
I have this exact same problem. It's really the only annoying thing about my apartment. Would absolutely pay for an off the shelf solution to this problem.
Glad I have a remote control with 40 year old tech that does the same thing.
This is great! Congrats!
Another option would be to install a smart timer in the outlet. However, you need to ensure that the heat won't automatically go on when the device is turned off, and sometimes the outlets are non-standard formats.
Hey Siri, can I afford a home loan?
I can't offer praise for controlling a mechanical thermostat with a poorly-implemented software thermostat.

If this was a remote control knob it might begin to make sense, but it isn't.

A NYC apartment with a 115V PTAC is by definition the size of a shoebox, is twisting a knob twice a day really that much of a burden?