I'm turning my "dumb" electric water heater into a smart one. Is it better to use ESPHome's Bang Bang Controller or HA's Water Heater integration?

I have an electric water heater with a manual thermostat dial that you turn to set the temperature of the water. I’m looking to turn it into a “smart” water heater so I could set the temperature from HA to save electricity when it’s a warmer day and I wouldn’t need as much hot water. That way, during cold days when I would need more hot water it wouldn’t run out so quickly when I shower, and during hot days it wouldn’t need to heat the water that much.

After very carefully opening up the water heater, I found the thermostat to be very rudimentary which means that turning it “smart” would be pretty easy to do safely. It’s an enclosed unit with a temperature sensor and a thermostat dial that just sticks to the tank to detect temperature and then switches on and off the 220V to the heating element according to temperature set by the dial.

The thermostat looks like this (I googled the photo):

I figured I would stick a Dallas DS18B20 to the tank for “Hot Water Temperature” and another Dallas DS18B20 to the input valve for “Cold Water Temperature”. I would then run the 220V going to the heating element through a relay. That way, I’m not bypassing the internal thermostat because the maximum temperature would still be regulated by the internal thermostat. So I’m not risking any damage from overheating the water beyond the designed specification.

During operation, I would set the thermostat dial to maximum and let ESPHome and/or Home Assistant switch on and off the heating element if the target temperature is below the maximum temperature possibly achieved by the water heater. So let’s say the water heater goes up to 60⁰C, and it’s a hot day so I set the target temperature to 45⁰C, then the relay would would turn on and off the heating element to maintain that 45⁰C. The internal thermostat would “think” that it’s heating to the maximum temperature because it supplies power to the heating element, but since power to the heating element is fed through a relay, in reality the heating element is maintaining the 45⁰C as regulated by ESPHome/HA. But let’s say it’s a cold day and the water heater could only go up to only 55⁰C, then the relay would stay closed all the time and the heating element would behave according to the internal thermostat.

The truly “smart” feature that I plan to build is the ability to automatically adjust the target temperature according to the temperature of the "Cold Water Temperature”. During cold days, the "Cold Water Temperature” would be lower so the target temperature would be set to a hotter temperature. But if it’s a hot day, the "Cold Water Temperature” would be higher so the target temperature would be set lower temperature.

I plan to use ESPHome on a Wemos D1 Mini. Now, I’m still not sure how I should proceed with programming the thermostat. I don’t know if it’s better to use ESPHome’s Bang Bang Controller or Home Assisant’s Water Heater Integration. I usually would prefer the thermostat to be programmed directly to ESPHome so it still works in case my HA goes offline, but I figured HA’s water heater integration would be more suited since it’s an actual water heater controller as opposed to a generic thermostat. Or is it just the same? I did try out HA’s Water Heater integration using the demo platform, but I found no difference compared to if I had used ESPHome’s Bang Bang Controller.

Sorry for the long post, I figured this is all necessary to properly give you all an idea of what I’m trying to accomplish. Thanks fellas!

ETA: Various minor wording corrections to make the explanation more coherent.

1 Like

Is this water heater to supply your hot water pipes, eg washing dishes and showering, or is it to fill radiators for space heating?

If the former, you have to keep it at a minimum of 60C or you risk bacteria.

Make Sure Your Hot Water Is Hot Enough! | Hot Water Cylinders LTD New Zealand.

1 Like

It’s just for showering. I don’t actually know what temperature the water heater is capable of heating to. I was just guessing a number to make the explanation easier to understand. But thanks for the heads up! I will definitely keep the minimum 60⁰C in mind.

Here is my 2 cents, noting that I don’t have much experience with this kind of thing.

I would have thought you would go with something like a Shelly or Sonoff relay device which can also do power monitoring, running ESPHome.

I would have thought that would be a reliable solution, which is probably good for this application.

Some water heaters have two elements, one near the top and one near the bottom. That would complicate the logic a bit. I’m assuming you only have one, but for anyone else considering this, make sure you check.

There really isn’t a lot to be gained by adjusting the temperature in the tank based on outside water temperature. As already mentioned, there is a lower limit you don’t want to go below without some very serious health risks. So the range you’d be adjusting is relatively small. Thus the standby losses would be very similar with or without your adjustment. Additional insulation may be a better investment.

Finally, understand that the thermostat is a binary device. Setting it higher doesn’t cause the temperature to rise any faster. The heating element will put exactly the same heat energy into the water any time it’s powered. If the water coming in is colder, it just takes longer to heat up.

That said, what you’re proposing is technically feasible. You take the thermostat (logically) out of the circuit by turning it all the way up, and put your relay in series with it. Now your relay controls when the element is heating. In fact, the thermostat will act as an overheat detector, and cut the power if your relay stays energized beyond the desired setpoint for some reason.

One benefit to your solution is that you have built-in energy monitoring. If you know how long the element has been powered on, and you know it’s power draw, you can calculate how much electricity you’ve used.

I wish my family understood that when they turn the heating up to 26C.

Me: “Darling, 26 is far too hot, we’ll all pass out. 21 is a comfortable temp.”

She: “But its really cold, I want to heat it up really fast”

4 Likes

I’m showering :shower: with esphome for years. But actually using the home assistant generic thermostat integration still. Why? Because I actually have two different esphome nodes, one controlling the relay (and do power metering, a sonoff pow r2) and on the other end there is a d1 mini with a dallas ds18b20 probe temperature sensor in the water tank.

I actually want to change the system to have temperature sensor and relay on the same esp and I can benefit having the logic directly in esphome. It will be more robust and would even work if the wifi is jammed or the ha server is crashing/restarting/on fire etc.

It was not to long ago I set the thermostat (ha) to heat and it activated the relay over wifi on the esphome node. But when ha was sending the off signal to the relay the esphome node was (for whatever reason) not reachable this very second and the thermostat in ha was off (indiciating all good) but the heater continued for hours wasting power before some one realized the warm water temperature was up to the sky (actually stopped by the internal thermostat like you describe it @RendyIrawan)

Per se it’s not dangerous to shower with legionella in the water, even drinking doesn’t harm the human body. The danger lies in inhaling them and accumulate critical colonies of them in your lungs. Best thing some one can do (specially when traveling!) is to avoid those misty (fine) shower heads :shower: and rather shower with the hose only :sweat_drops: Also better keep a safe distance from sprinklers :sparkler:

One can also try to keep it at a max around 25°C because then there will also be no growth. Also growing mainly happens when the water “stands”, so if you more or less permanently use your water and have a proper sized tank you also minimizing the risk of growing to much colonies.

Last thing to keep in mind (specially if you don’t permanently have legionella unfriendly temperatures in your hot water tank) is to do a regular “cleaning”. Typically heating the show up to a level that you can supply all pipes and faucets with 70°C for a minimum of 180 seconds.

Last but not least: Most “danger” of inhaling critical high amounts of legionella is typically in the very beginning of the shower act when the “old”/“still” water is released. So wasting a bit of water at the start of the shower could be advisable for some locations.

1 Like

Commercial solutions heat up over 60 only once a week or so, for an hour or two. It’s enough to keep legionella away.

Not really, legionella a virtually always present. The trick is to don’t of critical amounts of colonies (typically measured in cfu).

Most of the (known) and bigger Legionella pneumophila cases are typically not linked to (home) warm water systems but most of the time with public events containing air conditioning systems or water sprinklers. :bulb:

That’s what i meant with “keep legionella away”… not to dissapear, but to keep it in healthy quantities…

Is there a particular reason you’re using the generic thermostat integration rather than the water heater integration? Have you found the generic thermostat to be more suitable for use with a water heater? Or have you just not gotten around to trying the water heater integration?

I didn’t know the water heater integration even existed before you linked it :wink:

But if you build your system now and have the temperature probe(s) and relay(s) on the the same esp I highly suggest to use the thermostat within esphome. The front end in ha will actually look and behave exactly the same but it will be much more robust like explained before :point_up_2:

You could even add a button and led (even a display!) to the esphome node for manual control. Fallback AP is always a treat so you could (in case of emergency) connect to the esphome node directly to control your hot water.

How do you do, eg, the dishes with 25C water?

The same I would do with hot water. It’s still liquid @ 25°C :wink: and manual cleaning dishes needs detergent anyways - you might need slightly more with colder water that’s all. :bulb:

Human beings even manage to clean dishes without any water and do a dry cleaning often with help of ashes and sand :hourglass:

More uncomfortable is actually to take a cold shower when it’s not really hot (outside) :cold_face: :shower:

image

You can expect that the majority of the world doesn’t have access to (permanent) warm (running) water on a regular basis like most of the ha users probably have.

Many people don’t even have access to running water or clean (drinking) water :non-potable_water:

1 Like

Shameless plug: GitHub - dgomes/ha_generic_water_heater: Home Assistant Custom Component - Generic Water Heater

Hi All, just stumbled across this topic looking for some other answers to help me resolve something.

A lot of misinformation is being said in regards to legionella. That being said depending of where you live in the world you should check your laws and follow them. Below is only a suggestion and you would need to consult a licenced professional to advise you of your legal requirements.

If you have a hot water storage used for personal hygiene purposes the water temp must be no less than 60 deg C to avoid the likelihood of legionella bacteria growth. The water delivery to sanitary fixtures used primarily for personal hygiene purposes should not exceed 45 deg C. To do this a thermostatic mixing valve could be used and adjusted to an outlet temperature not exceeding 45 deg C at each outlet supplied from the thermostatic mixing valve. Temp limits are required to minimize the risk of scalding.

Again each country have different standards that must be followed by law.

True :tm:

I expect that only very few countries in the world really have laws against legionella. More will rather have norms or other suggestions which most likely have no law character. :man_judge:

Why should help that with legionella? That’s still close to the optimal growth temperature for them… :thinking:

I know places they do “thermal disinfaction” (literally killing legionella) by running very hot water - minimum 70 deg C - into the whole system including fixtures and faucets :drop_of_blood:

One could also say to don’t keep it no more than 20 deg C to avoid any growth :droplet:

Or in short:

I live in one.

It doesn’t, it helps with not burning yourself while keeping the water in the tank legionella free

Then it wouldn’t be much use as a hot water tank for personal hygiene purposes would it.

Everything @Blacky said is perfectly correct.

So do I.

Uhm, no. Here’s what the laws in my country (France) say about this. I would expect that most industrialized countries do have similar laws regarding this. Legionellosis is a serious public heath concern.

(Google translated)

These obligations are defined by the decree of November 30, 2005, known as the “temperature decree”, which deals with both legionella and the risk of burns. This imposes for tanks of more than 400 liters:

  • a water storage temperature above 55°C at the outlet of this equipment
  • or a daily rise in tank temperature
    2 minutes at a temperature > 70°C
    4 minutes at a temperature > 65°C
    1 hour at a temperature > 60°C.

It also imposes a temperature of more than 50°C at any point of the network with the exception of the terminal antennas; the volume of the latter must not exceed 3 litres.

Of course if you live alone and are the only person using your water, you’re free to do what you want and assume the health risks. But as soon as others come into play, and you DIY your water heating and distribution, you are legally liable if you do not follow code and someone gets hurt because of your modifications. Someone like your family.

This whole thing is not worth it anyway. Modern water heaters are very well insulated. There are many other ways to save energy in your home that do not risk the health of its inhabitants. Most of them are not technological btw. Like better insulation.

even if you only hurt yourself, in a country with some semblance of universal healthcare it costs the country, and therefore all of us. so not quite a victimless misdemeanor.