Update 31/12/2018:

See https://github.com/schlunsen/esp32_mqtt_relay for the relay control programmed with the Espressif-idf framework.

Modify a heat controller to control the ON/OFF state with an ESP32 using MQTT and MQTT Dash.

We live in two floored apartment where the temperature sensor for the whole apartment is placed downstairs in a hallway which never gets heated. With the emerging of cheap and easy deployable micro controllers like the ESP32, I thought it must be possible controlling/overriding our existing installation ( See below for pictures)

I wanted to be able to modify our existing heat controller and give it the capability of reaching it over WIFI, and have the ability of controlling it via my phone and an external temperature sensor, for automatic on/off during the night.

With the setup of 2 ESP32, a Raspberry PI, a 3v switch relay and a DHT22 I was able to do so :)

The code is Arduino based, along with a python script for automatic heat controlling during the night.

I use a Raspberry pi as the MQTT server, while also running the automatic python heat script.

Below I’ve listed my hardware setup along with a github reposity with the code.

Setup hardware requirements:

Heat controller and a way of controlling this with a relay.

Raspberry pi or similar.

3v relay like this or similar.

ESP32 - you can buy them cheap on AliExpress.

With external temperature sensor:

Another ESP32 or similar.

A DHT22 or DHT11.

You’ll find the code behind the project here :

External Arduino libraries:

You are able to get both libraries via the Arduino IDE:

Below I’ve captured some images of the installation we have here at home.