Water Heater Controller

Tags: #<Tag:0x00007fc41096aee8>

I recently automated my home water heater and like most projects the why didn’t really factor into the decision to automate. So now, that I am able to control the water heater, and good ideas on what to do with the data and how best to control the system other than turning it off when I’m away?

Mandatory project outline and pics:

  • xbee S2 connected as a ZHA device
  • Ardunio
  • 2x DS 18b20 temp sensors, one on the inlet and one on the outlet
  • CT for current
  • 65 amp Solid State Relay (overkill but cheap on eBay)

This is a slight aside, but… I keep wanting to get a Heat Pump Hot Water Heater (I live in South Florida). If you had something like that, it makes a lot of sense to try to defer heating until the hottest part of the day in whatever room it is in (for me it would be the garage). So my thought (if I get one) is somehow guestimate amount of water used (maybe outlet temperature) and so long as it’s reasonable, defer heating unless it’s near peak heat time.

Now for a regular heater that makes a lot less sense since modern ones are awfully well insulated, so the difference in efficiency by time or temperature is not very great.

Is your electric flat rate? Some areas it is higher at peak load times. That would be reason to also defer.

How do you monitor the temperature?

Two suggestions (one already suggested by @Linwood):
-> be able to setup off peak time for electricity price so it runs only during these times (if you setup an option).
-> be able to run it only half time (here we have a large boiler but most of time I’m alone at home, so during these days, it would be nice to get a button in HA to put the boiler in half-time heating mode :wink:


Not sure what you are looking for, i have 2x waterproof ds 18b20 sensors like these: https://www.amazon.com/dp/B01JKVRVNI/
Zip tied to the hot and cold pipes and covered with pipe insulation. The hot water temp is within 5deg of tank temp and the cold temp is really only accurate when water is flowing since the tank warms the water in the pipe. The arduino reads and reports the temperature every thirty seconds.

Thats a good thought, I was looking at solar power, and here they will buy anything that is generated in excess of demand, at more than market rates. So it would make sense to heat at night at the lower rate and sell power back during the day.

I travel a lot for work, so having it kick off during the week will probably save energy, I’ve set it to shut off during the night and workday, not sure if I will really see any savings from that.

One concern I do have, that I didn’t consider is that apparently legionella bacteria can grow in hot water systems, so I am thinking I should take the temp higher initially for at least thirty min to an hour to make sure if there are any, that they are killed. Was going to experiment, see if I could integrate temperature control, so then I could set the built in thermostat to 160F, let it get to temp, then have my controller hold it at 120F the rest of the time.

So zip tieing the sensor on the hot water pipe and insulating it gives you good readings? I thought there should be a constant supply of hot water through the pipe in order to get accurate results?

True, but as you can see it’s fairly close, you might be able to get better accuracy by mounting to the tank, but not sure it would be worth it. This is from this morning, the biggest change is in the cold water inlet temps.

1 Like

I also have an immersion heater for heating water… I have used 2 sonoffs - 1 for on/off and a 2nd one for measuring temp installed near the tank. The 2nd one also controls power to my water pressure system.


Mind sharing your code for this?
Working on something similar.

Whose code are you looking for?

I can now select to heat with immersion heater or with central heating…

Slightly off-topic, I have a solar hot water system with a rooftop heater, floor level tank and a controller. Two temp sensors, one on the rooftop unit and another on the floor level tank - do you think it would be possible to tap into these to give readings to an ESP?

@ PrairieSnpr can you share your code, is it comparable to a bang bang controller. I have an arduino with SSR and min and max temps so as not to constantly switch on and off. but like your idea. Also do you have any other fail safes as SSR’s are more likely to fail in the closed mode that can cause runaway temperatures.

Code is here, https://gist.github.com/prairiesnpr/7a40b78e765044252a4799d328327f0a caution, it’s rough. It’s been running for a year now, I still get intermittent high temp readings that I haven’t tracked down, and when home assistant restarts it will shut off the water heater. Other than that, the actual switching has been problem free.

As far as safety, I retained the controls of the water heater, I’m not controlling the water temp, just switching the power to the device.

hey talondnb, I have the same, just getting in to all this cool automation stuff. I’m getting Solar elec next week so I’m having the controlled load stuff ripped out, but i need a solution to make sure there is always enough hot water, so want to be able to monitor it and top up via solar power if i have capacity etc.

Do you have an answer to your question yet?

Hi John, nothing yet but I did stumble across this:


Still a WIP for me though…