Creating a Generic Thermostat to replace Nest in multi-zone HVAC

I’m thinking of playing around with the idea of Generic Thermostats again in Home Assistant. this essentially lets you build your own Nest/Ecobee from scratch and use existing temperature sensors instead of the ones that come with those units. It means you can configure which temperature sensor is currently in-use based on criteria from Home Assistant.

Generic Thermostats are tough to setup and get right, but if I had one setup, I won’t need a Nest or Ecobee at the next house. That’d be ideal; although, a little scary because Home Assistant issues would prevent my HVAC from working.

A Possible Project

I was in the HVAC room tonight and remembered I have a separate damper which goes to my theater room.

While it’s all connected with an open wall, I have another zone available on my Zone Control panel, and I could use that to prioritize sending air over to my theater room which gets much hotter than the rest of the house because of all the gear.

Since there’s no wall, other rooms would get cold too, but since that room’s also creating heat, it should cancel out.

Sadly, it’s fall now, and winter’s coming up. At that point, I probably won’t ever open that zone separate from my main zone, but I could configure Home Assistant to say “when the Nest is turned on for the Office, also turn on the Theater while heat is active”.

I could even go so far as to say “don’t send heat to the Theater while it’s turned on”, and in the opposite, I could say “if the Theater is turned on, use that thermostat instead of relying on the Office”.

Lots of possibilities here! I’m even wondering if I could replace my Rachio completely with Home Assistant. Separate issue, but it’d give me a lot more flexibility.

Configuring a Generic Thermostat

Is there an easier way of configuring a Generic Thermostat? Do I use a Raspberry Pi or ESP8266 or ESP32? What am I connecting and how many relays do I need?

  1. I have both heating and cooling.
  2. I have 2-stage heating and currently 1-stage cooling.
  3. From my understanding, you also wanna set a timeout to prevent the thermostat from turning on and off too frequently.

Relay Configuration

image

  1. FanRh | G
  2. CoolingRh | G | Y1
  3. Heating: Stage 1Rh | G | W1
  4. Heating: Stage 1Rh | G | W2

How many relays are required to set that up?

Rh and G are always connected, so I could have a relay connect that circuit no problem. The issue is how to choose between Y1, W1, W2, or neither.

Away temps

How would I configure “Away” temperatures? I’ve only seen “Home” and “Away” states in Home Assistant for security devices. I haven’t seen it for thermostats as something I could configure.

I guess I could set up a toggle for that based on who’s phone is in the house or manually configure it for a guest based on activity from motion and presence sensors as well.

Radiant Heating

image

I don’t have radiant heat in these rooms, but I do have heated floors in the master bathroom. While I’m not switching that to a generic thermostat, I’m curious how you’d handle radiant heat.

Is there some algorithm to make it simpler to setup through a Home Assistant automation?

As far as I know, you have to heat it up to a point and then “know” that it’s going to heat up more by itself, then you need to keep turning it off and off at intervals as it drops in temperature to keep it consistent. Seems really difficult compared to air.

Anything else?

What else am I missing?

After looking around, I wasn’t finding anything. I harassed ChatGPT for a bit, and it gave me this:

I didn’t consider that Y1 and G don’t need to be connected together. All they need is power from Rh :man_facepalming:.

image

I’d need at least 3 relays. Now, I have a board with 4 relays and another with 3, but man, that’s a lot of things to keep track when I really want something that’s all-in-one.

I have a bunch of ESP8266s that I was using with NodeMCU in the past. Those could work, but the wiring is nasty for this. Wires would be going everywhere as well as the code I’d have to write to support it, connect it to Wi-Fi, etc.

The ideal case would be something that takes my Rh’s 24V power and provides 1 connector for the others. I would internally handle switching on and off the relay without extra wires. Something that looks like this:

I’m sure something like that already exists, I just have to find it.

As I see it you need three relays.

The way I would do it would be two relays in series for heating and one for cooling.

Slightly simplified view

This means the first relay has R to common
NC nothing
NO is connected to the second relay.

Second relay has the above on common.
NC is W1
NO is W2

G can be feed from any W1 or W2,

For cooling you just need one relay and again feed G from the same as Y1.

Do you have some access to the cables in the utility room? Would be a nicer solution to do all the wiring there than in your living space.

1 Like

Thanks for your suggestion! I can try that out :). Although, it’s the same either way right? I still need 2 relays for W1 and W2 regardless.

I’m also not sure I understand what you mean about connecting the fan G.

I have access to wires in my HVAC room. I actually put the 4-zone panel in there around the time I moved in because the 2-zone panel stopped working, and I figured I might try something like this in the future. Took 7 years, but here I am :stuck_out_tongue:.

Testing this out

I found a 4-relay board I had sitting around from when I was trying to do some self-automation stuff years ago. It has Ground, In 1-4, and VCC (5V power?).

I also found an ESP8266 and a breakout board designed for it. Gonna make wiring that much easier for this prototype.

Doing some research on ESPHome, it looks like I can flash it on my device as an OS, and then I can program it via Home Assistant. Much simpler than NodeMCU or flashing Arduino software.

All-in-one solution

I also found this board. It’s for Tasmota??? And I guess you can use ESPHome for it instead?

If I could find a board like this that wasn’t from a Chinese fly-by-night company, I’d be set!

Yes.
You will need at minimum two relays.
Having them in series as I did means only one at the time can get power.
Placing them in parallell means if you mess up both get power at the same time.

Whenever you need heating or cooling you always need G to be connected.
So instead of having a separate relay for only fans ( :grin: ) then you can use the same wire that goes to W1 or W2 and also connect that to G.
But that will need diods to make sure you don’t backfeed the other connections.

The easiest is probably a four relay board as you have in your post.
But I would still recommend you connect the W1 and W2 as I draw it above. I wouldn’t want to risk feeding both W1 and W2 at the same time.

But then on the other hand you could also be feeding both cooling and heating at the same time.
I don’t know what happens to the receiver when that is done.

1 Like

Great points. Yeah, I’m not sure what would happen if both heating and cooling are active. My guess? It’d run both heating and cooling. Worst case is if G isn’t connected for some reason. I’m pretty sure that’s a huge issue waiting to happen.

These will still be connected to my Zone control panel, so it’s probably got some safety features. I know it’s already setup to intelligently combine the outputs of multiple thermostats.

In terms of the relays and ESPHome, I got that working (you can see my wires here):

image

I’m not sure how Home Assistant handles the Generic Thermostat. I added it, but it’s heat or cool. I can’t seem to figure out how to setup 2-stage heating either:

My tolerances need to change as well as I’m in Fahrenheit, not Celsius. Typically, it’s 2 degrees for Y1, 1 degree for W1, and 2 degrees for W2.

One thing I’m looking up is if W1 is supposed to be energized while W2 is energized. That’s something I’d need to know, but I can’t seem to find any concrete info online.

I’m sure the generic thermostat does not have two stage control.
But perhaps two generic thermostats set with an offset could create this.
So W2 has a larger cold tolerance.
Or just make an automation to do it.

Do you have an thermostat somewhere you could test on?
If it’s an old “mechanic” then you can probably disconnect it and use the multimeter and see if you get continuity between W1 and W2 (or R and W1, and R and W2) when the termostat is set to a high temperature

W1 + W2?

Are you saying if I take a multimeter with an old thermostat, it’s possible I can check if W1 and W2 make that beep sound?

I’m wondering if I could just look it up online and see how Nest handles it.

2-stage heating

I was thinking of making this whole thing a Home Assistant automation, but I’d rather use the built-in climate type if I can. Then Dashboard items will disable correctly and Home Assistant will overall work better that way.

I’m also wondering how to get AC vs Heat. I can add my Nest Thermostat, and it works fine with Fan, Cool, Heat, or Both. I don’t understand why Generic Thermostat can’t do more than one mode.

This is what I was expecting to see:

From the Generic Thermostat docs:

One Generic Thermostat entity can only control one switch. If you need to activate two switches, one for a heater and one for an air conditioner, you will need two Generic Thermostat entities.

There’s some who made a climate_group entity to associate multiple thermostats together. Not sure how it works for my case, but maybe I can combine them into something similar to a Nest :person_shrugging:?

Another interesting board design

Not saying I’m gonna buy this, but I found a board that has the kind of design I was looking for where I can connect Rh once and not 4 times.

It should…
If both get power at the same time then the continuity should be between W1 and W1 unless they made some complicated connections inside.
But you should defiantly be able to figure out if both are active at the same time with beeper mode.
Or I’m missing something. But I doubt the mechanical type of thermostat is a complex thing.

I believe you can.
I have thought some more since last post and I think the better approach is to have two generic thermostats with different target temperatures.
So you have one controlled by you set to 74.
Then you have one that is set with an automation triggering on the one you set, to be set to 73.

This means the one you control will trigger W1, and when it’s cold enough for the second to kick in then it will trigger W2.
I believe that is a better solution than setting different cold tolerances.

This is for the BBQ so that I can set a temperature range and it alerts me if above or below.

swingerman/ha-dual-smart-thermostat: The dual_smart_thermostat is an enhaced verion of generic thermostat implemented in Home Assistant. It uses several sensors and dedicated switches connected to a heater and air conditioning under the hood. (github.com)

I’m not sure what is on this board but it seems to be opto couplers?
Not sure if they will work on 24 volt, but I like that better than relays.
I assume (perhaps I’m wrong) the wires are only used to signal and there is not much load on them.
Opto coulplers are more reliable than relays that can become sticky.
Heating is not something you want to have break or be unreliable due to sticky relays.

1 Like

Well that’s cool! The dual-smart-thermostat thing is actually what I’m looking for it seems.

But it only supports 1 cooling stage. This is the kind of integration that would make me not want to upgrade my HVAC system :stuck_out_tongue:.

Either way, I think at this point I’m going to quit trying. Until I can figure out a better way to do this, it doesn’t make sense to keep fiddling around with it.

It was a fun project to play around with, and it was neat connecting the relays and setting up ESPHome, but it seems like this isn’t yet for someone like me that wants a full HVAC thermostat replacement.

I went ahead and bought 3 Ecobees, and I’ll use those for now :confused:.

Hey, i was planning to create my own thermostat compatible with home assistant. 2 stage heating and 1 stage cooling. Need multiple generic temperature sensors to average out home temperature.

Did you abandon this project?

I did abandon it :frowning:. Home Assistant doesn’t have a robust thermostat solution for a home.

Notes

I was excited to use my temperature sensors and create a template sensor that’s an average of them and connect some relays, but it’s just not something that really makes sense unless you wanna roll everything in your automations.

There are a lot of things you take for granted with regards to thermostats. Sure, connecting cables is easy, but knowing when and for how long to connect those is where the magic comes in. Single-stage heating or cooling is no big deal, but multi-stage gets more complicated.

The real reason

Either way, that’s not why I killed this; it’s actually because I couldn’t get a native thermostat interface in Home Assistant without writing a custom integration (Python), and I didn’t wanna bother supporting something like that outside of YAML. If I could do it in YAML, I would’ve just home-rolled my thermostats.

Ecobee Thermostats

In the end, I ended up going with Ecobee Smart Thermostat Premium, 3 of them.

You can configure them to let Home Assistant do all the heavy lifting, and they’ve been working really well. With the HomeKit integration, you have local access. I have no Apple devices, but I can still use HomeKit through Home Assistant.

One thing I’m not sure is if you need the phone app or not to set this up. I got it on Wi-Fi without an app, so I’m not sure why I even have the app at this point.

In terms of features, their in-app history is non-existent even though Nest has it, but you can get that data from Home Assistant anyway. I also don’t like that their thermostats have a proprietary protocol for sensors. Still, any Ecobee sensors are fully addressable by Home Assistant with the HomeKit integration. I can actually use them in automations for temperature and motion!

Their thermostats are actually pretty nice looking on the wall too.

Still something I’m interested in doing

If Home Assistant improves their generic thermostat support, I’d still consider switching over to my own solution. I like having fun projects to tinker with, and this is a relatively simple one to get working. It’s just connecting some wires based on temperature values.

For a critical function like hearing the house (I live in a cold climate and heat failure means frozen pipes) I recommend a very simple system without alot of moving parts. Every part fails at some point. Using HA means - it works, the pi works, your WiFi works, the sensors work, the comms to the relay work, the automation works, the relay works and the furnace works. That’s a lot of stuff to count on.

So using an autonomous device like a thermostat is the way to go. You can then create algorithms in HA to manipulate its setpoint based on other temperature sensors, outdoor weather, etc. This allows the HVAC to continue to work when your HA update fails and allows for supervisory optimization when HA is functioning.

1 Like

That’s a great point! I also live in a cold climate part of the year, and freezing pipes is a big issue if your heater fails. Also have to worry about it getting too hot in here too. I have kids.

In this case, it’d be Home Assistant getting an update, I restart, it turns off the heater, and that potentially causes problems if something doesn’t come back online.

I was putting together the thermostat as an ESPHome device so even if Home Assistant restarted, it’d still keep the relays going as they were; although, it won’t turn on or off based on the temperature without Home Assistant. You can still control it manually from a web UI, but that’s not really good enough.

I agree, it’d be better if the device was self-contained and all you did from Home Assistant was set the ranges and the current temperature. If Home Assistant was down, it would use its own temperature sensor, but my plan was to have it in the basement; far away from the location it’d control.

I see now why generic thermostats aren’t as common. It’s a lot of moving parts!

If it was ESP-Home you had in mind then a climate would have worked I assume.
I have never tried this but it seems to do the job.

1 Like

Almost all thermostats sold today are “Learning” thermostats, in that they learn the Heat response of your home. As an example the heat comes on, the room heats, the thermostat turns off and the heat continues to increase due to the delay between the heat entering the room and the thermostat sensor detecting it. So it figures this out and reduces overshoots. With hot water systems this is a fairly big delay. They also know based on the configured heating system type what the optimum number of cycles per hour is. You don’t want your system cycling on / off too quickly as that’ll use extra energy and prematurely wear the equipment down. So a lot of stuff to reinvent that already exists and is proven.

I’m not sure if that’s true. On my Nest Learning Thermostats, it set random temperatures all the time, and that made it very uncomfortable. I don’t know if it learned anything about my system.

I actually turned off the “learning” mode, but it did have some features like when you set the temperature, it’d say “will be 74F in 2 hours”.

Ecobee doesn’t do that from what I’ve seen. I also turned off their “learning” modes to configure it via an automation in Home Assistant lest it randomly changes temperatures on me.

I had a Nest and now have an Ecobee in the master bathroom where I have heated floors in a fairly large space with 12’ height ceilings. Nest had a “radiant heat” mode so it’d know to start heating early. Ecobee has a “Boiler” mode which, on their website, also says radiant heat:

Boilers (boiler radiant “heat-only” system)

It will enable this mode by default if it doesn’t see a G or fan attached and you have a W1 cable.

Nest also had a mode to keep blowing cool air after the AC compressor turned off. It’s a neat feature, but I’m not sure how well it worked nor if Ecobee has anything similar.

None of my thermostats have a mode to reduce cycling my system on or off, but you can program them to have waiting periods like “don’t turn back on the AC if it’s been too soon since you last turned it on”.

I get that these are all very nice features to have in a thermostat that solve a lot of problems, but it’s not self-learning. Those are features I have to enable by preference, and I’m still manually setting which temps occur at which times.

I do this now in Home Assistant because programming it at the thermostat or in their apps sucks. Also, I can switch out the thermostat and not have to touch my automations (as happened when I switched from Nest to Ecobee).

This climate for ESPHome is exactly what I needed! OMG… I wish I’d tried that out.

I am using climate component from ESPHOME right now… Please check this repo DIY Thermostat ESP32 for more details. Please do provide feedback if you guys have any suggestion. I Have at present tried to keep the system redundant using relay board. But for future improvement I will move away from relays and use optocouplers and also feedback from the output to confirm if the system is performing the operation its suppose to perform.