Hacker News new | past | comments | ask | show | jobs | submit login
DIY Wi-Fi thermostat from scratch with ESPHome and Home Assistant (olegtarasov.me)
117 points by oleg_tarasov 70 days ago | hide | past | favorite | 27 comments



Nice!

This references a couple of OpenTherm project, so let's add the usual disclaimer:

The OpenTherm protocol is not open.

You can only find the spec for v2, they are now drafting v5. Yearly membership is about 3K if I remember correctly (without testing software, just for the spec).

There seems to be big difference in what you can do after v2, and it includes power delivery, maybe more fine grained control on heating curves and such (unclear, I don't have the spec)

Not all boilers support opentherm (but most should), and those who do don't support all features (but the most basic should always be present).


Thanks for the context! I didn't research OpenTherm much, since my boiler is one of the most basic models on the market. It supports just the bare minimum from V2 spec, but it works, so I'm not complaining :) This boiler was already installed when we bought the house, so not needing to replace it was a great way to save some money for remodelling.

Otherwise, I completely agree that charging 3K for the spec is a stupid money grab. When the time comes to build a new house and choose a new boiler, my choice will be influenced by what protocols are available and whether I can control the boiler with my own thermostat.


esphome is by far the best and most useful piece of software I've encountered in a long time!

Even for non home automation. Simple web API to turn gpio's on or off, coupled with some relays makes for a great easy yaml configurable industrial automation system


I completely agree, using ESPHome beats writing firmware from scratch, even though lots of Arduino libraries are available. But the flip side is that ESPHome is in active development with lots of contributors, so sometimes things don't work as you might expect. And if that happens, your only option is to spin up an IDE and dive into source code :) For example, during this project I had to fork an abandoned OpenTherm library and rewrite almost half of it, as well as contribute a couple of bugfixes to ESPHome itself. It was actually fun, and I expected something like that from the beginning, but such a sharp drop from a cliff when YAML config doesn't work, will be a surprise for most people :)


Can confirm, I did some automation on a Ritto TwinBus doorbell using ESPHome, and it is rock stable:

https://keilerkonzept.com/blog/ritto/


Thanks! We're continuously improving it and nowadays have two people full-time working on it.

If you want to hear about the future of ESPHome, make sure to tune into the State of the Open Home next week: https://www.youtube.com/live/oa__fLArsFk


I went with a more passive solution. I have a fairly regular schedule, for full disclosure. I just bought a few wifi sensors and placed upstairs and downstairs and monitor it. I then set a schedule on my thermostat to reasonable values and have my remote sensors set to +/- 2 degrees with a pop up alert if they don't meet the schedule that I programmed which is worth noticing. No wifi thermostats, just ones that will probably last 15-30 years. The older I get more I grow tired of squeezing out that last 5% of value for 90% more effort and I appreciate the old ways, turning off lights when I leave a room. Unplugging things when I'm not using them. The one automated thing I do appreciate though is my security and camera system, those have actually proven valuable over time and well worth the effort to self install.


Yup. Twiddlybobs look nice and gain WAF, but a thick mesh of sensors and a plan work a lot better. Zigbee TRVs are a good midpoint for balancing monitoring and control.

FWIW I still use Hive for boiler control but HA overrides that locally for fine control.


Have to say with my background individual room control and measurement always seemed the nirvana, but it seems like a lot of heating design is moving away from this to more constant input / constant loss with outside temperature curve adjustment. Take a look at heat geeks.

You’ve got quite a complicated system there. Some of the key design parameters are about getting balanced flow (proportional) rather than bang bang controllers so that you optimise the delta flow return and operate the heat source at lowest realistic flow return values for efficiency.


This is called outdoor air temperature reset. It's been commonly used in medium to large size buildings (ie multi residential buildings) back 100 plus years.

Originally there might have been an operator doing the adjustment daily, later mechanical automation, later electronic control.


> Take a look at heat geeks.

Is this them? https://www.heatgeek.com/


yes they have quite active YouTube channel


I had no idea people can get degrees with just PID controller. On top of that, people actually just eyeballing the coefficient in practice lol.

https://web.archive.org/web/20240415040111/https://s3.filebi...


So at the end of the day -- I understand this is a satisfying project to undertake. Operationally how is it functioning through the winter and how much upkeep is required from you?

I've looked at doing something similar for my home system but the LOE + upkeep make me think the reward to work ratio isn't right.

That said I also know that I probably can't find anyone to help build the proper system at my house -- so its a situation where if I want it right I need to do it myself :'(


After I finished debugging the prototype, it required literally zero maintenance throughout the winter. Actually we were not living at the house at all, contractors doing remodelling work were living there instead. I installed a LCD screen with basic temperature controls and they had no problem with it whatsoever.

Doing this project from start to finish took me 2 or 3 months on and off, mostly during the weekends.

Doing it right yourself is the exact solution I arrived at myself :) I was shocked to discover how low the average technical level of local contractors is. I was super lucky to find a highly professional guy to overhaul the pipework, but anything more complicated I had to study on my own. Luckily, there is a ton of youtube videos, so the only thing you actually need is time.


Well done on the maintenance part! I think you are really helping me out a lot as I may not be up to the same level of effort for redoing our heating system.

It seems like this kind of think should be very doable in the industry but capability seems to be the big challenge.


Also do you have any concerns about software maintainability say 10-20-30 years from now? Can someone else pick up this system and run it if you sell your house?


Not OP but I have a lot of home automation. I did all of the work myself. It’s easy enough to swap the wall switches and the thermostat back to what came with the house.

A lot of my stuff is set and forget. Home Assistant doesn’t need to be updated or monitored. As long as nothing talks to the internet, all I need is backups of the config and spare SD cards.


Maintainability is a concern that I haven’t figured out yet :) Right now my plan is to replace my DIY thermostat with off the shelf device suitable for my boiler when we sell the house. All the advanced features will be lost, but this still is the average expected level of automation in the area :)


I came into this expecting to see a questionably reliable implementation of a thermostat that could damage equipment or burn the user’s house down.

Instead, I found something closer to what I’d do. The boiler has its own thermostat and control system. If home assistant goes down, everything is still in a safe state.

I have home assistant hooked up to a rather dumb “smart” thermostat. It’s just smart enough to be remotely controlled. I’d far rather use that than have a raspberry pi flipping relays.


Yes, safety and robustness were my primary concerns while designing this project. This house is more like a vacation home, and we don’t live there permanently. So my main goal is being able to control remotely as much of my heating system as possible, making sure not to burn the house down at the same time :) Here is what I took into consideration:

1. My device interfaces with the boiler through optocouplers, so I don’t touch boiler circuits with my crappy engineering skills.

2. The boiler itself, as well as OpenTherm protocol, seem to be able to recover automatically from many failure modes. It doesn’t matter much if some frames are dropped or mangled, since full set of control signals is repeated every couple of seconds.

3. I rewrote critical parts of OpenTherm component for ESPHome to make code more resilient to failure. The whole firmware is designed in a way that incorrect values or broken frames don’t bring anything down catastrophically. I also made sure that boiler has its own maximum temperatures set to sensible values, so that incorrect signals from the thermostat will be discarded.

4. The device is designed to be completely self-contained and doesn’t rely on Home Assistant or Wi-Fi being up.

There are a couple of things that I plan on adding to this setup, like a Shelly relay on boiler power input to be able to do a hard restart remotely.

Ideally, I would also prefer not to McGyver a custom device, but unfortunately, there are no such dumb smart thermostats for my boiler that would allow remote control.


I was hoping to see some plots of the PID temperature control in action, I'm curious what is the final fluctuation in room temperature with a setup like this.


Thank you for the suggestion! I will try to add some plots if data from winter months is still available in Home Assistant. Based on my observations during winter, room temperature fluctuation is usually ±0.3° C around target temperature, which I consider to be pretty good for a first prototype :)


Great, thanks for the response. I'm using off-the-shelf radiator TRVs (Aqara SRTS-A01) which use some internal PID program based on the supplied actual and desired temperatures and I experience similar fluctuations in room temperature.


You don't need the AI generated picture at the top of that article.


It is a nice touch tho


Not really though; it implies that's what we're building, and does the article a disservice. A picture of the actual project is far more useful




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: