Weather Interlock for Home Heating - IoT RasPi Zero & ESP12

Introduction: Weather Interlock for Home Heating - IoT RasPi Zero & ESP12

About: Maker of things.... some get completed...


To note,

This project relies on you having a RaspberryPi Zero running a Domoticz home automation server (quite easily made) with node-red and is set up as an MQTT Broker.

Why write this showcase?

To showcase my solution of how I have saved some heating costs/energy use and to seed the thought into you, so it can be adopted into your home or modified to suit your needs.


In the Spring and Autumn months where the outside air temperature can be around 11degC I noticed my house lost little to no temperature to outside. I also noticed that in the morning the heating would come on for some time (up to 30minutes) then stay off until the next day. I saw this as a waste of energy as on a sunny day or as at warms above 12degC outside the house will naturally warm to a comfortable temperature. Normally this would be the time of year that I would turn my heating off to save Gas usage. This project is to automate this process based on local outside air temperature and utilizing some of my existing household temperature sensors, the project has the advantage of knowing the temperature predicted and acting upon it but if the house lost too much temperature it will allow the heating to come back on.

Project Requisites

  • Use local current outside air temperature
  • Use local forecast outside air temperatures
  • Prevent the heating from operating but not affect hot water production
  • take into account household conditions (but not to be too sensitive)

Step 1: Hardware/Software Service Setup

  1. Raspberry Pi Zero running as an MQTT Broker with Domoticz and Node-Red complete with local sensor (Room 1) Dallas 18b20 type.
  2. ESP12 running an Arduino IDE program, this controller also conducts the interlock with the heating at is sited in the cupboard where the heating control valve is. This too has a local Dallas sensor (Room 2) for the adjacent room.
  3. ESP01 running an Arduino IDE program to transmit local room temp/humidity readings from a DHT22 sensor (Room 3).

Step 2: Data Retrieval

Room 1, 2 & 3 temperature readings are sent to the Domoticz home automation server for data logging and easy viewing this is sent via MQTT messages using DomoticzJSONformat, I use node-red to create an average temperature reading of the 3 rooms which is then re-transmitted via MQTT to interested clients (ESP12 being one) and to the Domoticz for logging.

The Domoticz server also connects to OpenWeatherMap to retrieve local weather conditions (every 10 minutes), the Domoticz also re-sends this data on via an MQTT “out” topic, however, the size of this message is large so I use node-red to change and delete this data to just contain the temperature information, this is sent on a topic that the ESP12 is subscribed to. Additionally this the node-red will connect to OpenWeatherMap and retrieve forecast data for my area, again this received data is very detailed and contains information for 5 days so I use node-red to adjust this down to the next 3/6hour temperature forecast and again re-transmit is on the same topic as above.

Step 3: Physical Heating Interlock

The ESP12 is located in the same cupboard that has the hot water storage tank and wiring connections for valves/thermostats. Being experienced in electrical control systems I traced the cable to discover the main room thermostat cable, I ran a suitable mains rated cable to my control box and installed a relay that the ESP12 can control. I wired the ESP12 relay in series with the room thermostat so it can keep the heating held off if required. Additionally, I was concerned about ”what if the ESP12 failed” so I placed a physical switch in parallel to the relay so I can restore normal conditions if needs be ( I’ve not had to yet).

Step 4: Software Operation

The ESP12 has some set points for the current outside temp, 3-hour forecast temp, 6-hour forecast temp and average house temp.

See flowchart.

To summarise, the heating will be disabled if the outside temp is above 10.5degC and the average house temp is above 19.4degC (my Thermostat is set to 19.5degC) OR the forecast for the day is above 11degC. The heating is enabled if the various readings are below setpoints set slightly below the previously mentioned setpoints to reduce nuisance switching.

Step 5: Future Development?

  • Take into account whether it is sunny or not, when the house isn’t baked in sun he setpoints could be lowered.
  • wind conditions?
  • incorporate remote override

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Rice & Grains Challenge

      Rice & Grains Challenge
    • Puzzles Challenge

      Puzzles Challenge
    • Lamps Challenge

      Lamps Challenge


    DIY Hacks and How Tos

    Nice setup. You should enter this into the Microcontroller contest.


    Reply 4 years ago

    Thanks a lot, I’ll look into it!