Welcome to my first post. The idea behind it is that I wanted to start making my house a bit smarter than it is. What makes it harder for me is that I live on rent so I can’t change too much at home. One of the things that used to work almost all the time was the water heater so that was my starting point, given that saving on the bill is one of the goals. To make your water heater smart, there are already a few options on the market. Here is one of them:

MClimate’s Bobbie

MClimate Bobbie Melissa Climate is a Bulgarian company for smart home products. Their smart water heater controller has great functionality and looks. In the package they also provide you a temperature sensor which you hook up to the hot pipe coming out of your water heater so it monitors that too. MClimate Bobbie

The deal breakers about this product for me are:

  1. It doesn’t support HomeKit (I am heavily into Apple’s ecosystem, so HomeKit support is a must for me)
  2. It costs € 129.00 (about 260 BGN, probably the water heater I’m stuck with costs less)

China’s Sonoff on the rescue

Sonoff TH10 and TH16

Sonoff is a Chinese company that produces a lot of types of smart home products: switches, wall switches, wall plugs, smart bulbs and etc. The good thing about them is that they’re cheap and useful! Even cheaper than building a similar device by myself (I checked that first)! What’s better though is that most if not all of their devices are “hackable”. Meaning that you can flash their firmware pretty easy.

For the purpose of my goals, I went on AliExpress and found the Sonoff TH16 to be the best candidate, it even has a temp sensor to monitor the hot water. It cost me about $15 with shipping (about 26 BGN, quite cheaper huh?).

Let's get started

So first of all, Sonoffs come preinstalled with their own software you can go check it out. I don't like it... It uses a cloud to talk to the devices, meaning no internet at home, no connection to my devices. On top of that you have to use their mobile app, no thanks. HomeKit sounds like a better option.

Thanks to the awesome community at GitHub, there are great alternatives:

1. Tasmota Open Source Firmware - works via web interface and MQTT (which means that you need a server being a MQTT Brocker for the devices to communicate). I'd use that if I were an Android user.

2. ESP-HomeKit-Devices - Works to bring Apple HomeKit to several devices based on an ESP8266 chip (like most Sonoffs).

I tried Tasmota first. It is very very capable of running on almost any type of IoT device, but with RavenCore's firmware I can omit the server and just use Apple's HomeKit (because I have an Apple TV set up in the local network).

Flashing Sonoff using Raspberry Pi and Arduino

On the above image you can see how I flashed the software. I used a Raspberry Pi B3 to connect to the ESP8266 via serial. It turned out that the Pi can't provide enough power, so I used an Arduino I had around to give it power separately. I then used ESPTool to erase the flash and put the new firmware and voalla!

Mounted the Sonoff TH16 and Running Not the prettiest of all but it was working.

This was the finished product! Didn't work out too well though... On the next image you can see why.

Mounted the Sonoff TH16 and Running but dead

Turns out that despite it being up to specs with the water heater, the TH16 doesn't do well with high currents. Okay, no biggie. It just means we have to do it differently.

How to do it properly

Diagram and result

Requirements and prerequisites:

1. Sonoff Basic
2. USB-to-Serial Adapter
3. RavenCore Firmware
4. Contactor Schneider AC ICT 1P 25A 1NO 240V - this one is a bit more expensive but I've been told it's the most reliable.

Above you can see my solution to the problem: using a cheaper Sonoff (Sonoff Basic $6 with shipping) and a contactor (cost me about 35 BGN). What we are doing here is offloading the current from the Wi-Fi Controller to the contactor. This way it's much safer and less harsh on the controller.

All that's left is to solder a temperature sensor to it for hot water reading. Then, for example, it can be configured as a thermostat, therefore you can easily play with the temperature turning it on/off.

End result

End result, Sonoff and contactor mounted End result in the Home App

Now the water heater automatically stays shut down when there is nobody home. It turns on mostly at night, when the electricity is cheaper and I can make sure to have it turned on while I'm on my way home to take a shower.

I hope I helped making your home smarter.

I am not responsible for any damage caused by my tutorial. Do at your own risk. Make sure you follow electrical safety rules!