Smart Heating (part 1)

There have been many new ‘smart’ thermostats released recently. Not to be outdone I wanted to see just how hard it was to convert my existing heating system into a smart system and integrate into my existing Domoticz Home Automation System.

The Brief
The system would start but just replicating what my current system does today but with all the added functionality of having it in my home automation system ( web control, easier programming, holiday schedules and voice control via Alexa). Water would simply be on a timer with the option for a manual override if we ran out of hot water during the day. Heating would be on a timer, including manual override, with a single room thermostat.

My ultimate goal is to replicate the learning thermostats on the market today. The idea is to use the data I gather to learn how much energy it takes to heat up the house and then use a TPI algorithm (Time Proportional & Integral) to calculate how long the boiler needs to fire for to keep and maintain the set point on the thermostat. Then extend that to factor in multiple rooms not just the single room the smart thermostats available today.

The Hardware

There were two bits of hardware I looked at

Fibaro double switch (http://www.vesternet.com/z-wave-fibaro-double-switch-2-gen5)
Secure 2 Channel boiler receiver (http://www.vesternet.com/z-wave-horstmann-z-wave-controlled-boiler-receiver-two-channels)

I went with the Secure 2 Channel boiler receiver as was compatible with the backplate for the existing programmer. This allowed for a quick swap without altering any of the existing wiring. I even left the existing thermostat wired in to act as a failsafe. If for some reason my system crashed and kept the boiler firing then the existing thermostat shuts down the boiler at a predefined cut off. It also helped when I was developing the code – I could reduce the failsafe temperature down to about 10⁰C so that the boiler wasn’t physically switching on and off all the time whilst testing.

The Software

In Domoticz the system is controlled by the following devices.

Boiler – Water Switch Controls the Water Channel on the receiver
Boiler – Heating Switch Controls the Heating Channel on the receiver
Water Boost Virtual Switch to give some extra hot water if we run out during the day
Heating Boost Virtual Switch to turn on the heating for a set period of time
Heating Virtual Switch to say if the heating should be on or off
Hallway Thermostat Virtual Thermostat Setpoint used to set the desired temperature
Hallway TempHum Temperature and Humidity sensor in the hallway

 
Screen shots showing the devices created in Domoticz.

Controlling the Hot Water
Luckily the hot water set up is pretty simple. All I wanted is to replace the existing functionality – basically a programmable timer and a boost option if we were to run out of hot water during the day. This can all be done via the standard Domoticz controls.

The [Boiler – Water Switch] is on a timer set to come on at 3am and turn off at 4am every day.

The [Water Boost] has on / off commands that just control the [Boiler – Water Switch]. The difference is that the [Water Boost] has an Off Delay of 1800 seconds (30 min). This has the effect of turning on the water just for 30 minutes independently of the schedule.

On Action: http://192.168.1.50:8080/json.htm?type=command&param=switchlight&idx=505&switchcmd=On
Off Action: http://192.168.1.50:8080/json.htm?type=command&param=switchlight&idx=505&switchcmd=Off

To date this has proven very reliable and no issues.


Controlling the Heating
The Heating is a little more complicated. In the first instance I wanted to keep this as simple as possible, prove it works and is reliable, then extend the functionality to make it ‘smarter’. The would be replicating the existing systems of a single thermostat

As mentioned in the intro my ultimate goal is to replicate and improve upon the learning thermostats on the market today. But for now I’m settling with turning it on and off..

The virtual [Heating] switch will be on a timer like the hot water and the [Heating Boost] will just turn on and off the [Heating] with an Off Delay of 3600 Seconds (1 hour).
Behind the scenes the [Heating] switch would be used in conjunction with the thermostat setpoint and temperature sensor to control the firing of the boiler.

I defined the minimal amount of control logic to create a working system with the following three statements

  1. If the Heating is off and the Boiler is on then turn off the boiler.
  2. If Heating is on and the temperature in the hallway is more than 0.5⁰C colder than the thermostat setpoint then turn on the boiler if it is currently off.
  3. If the Heating is on and the Temperature in the hallway is equal to or greater than the thermostat setpoint then turn off the boiler if it is currently on.

Another way to visualise this is the in the following control flow

This is implemented in Domoticz through the a time triggered LUA event. Domoticz has an automatic loop that triggers this event every 60 seconds.

commandArray = {}
if otherdevices['Heating'] == "On" then
   if otherdevices['Hallway Thermostat'] - otherdevices_temperature['Hallway TempHum'] > 0.5 then
      if otherdevices['Boiler - Heating Switch'] == 'Off' then
         commandArray['Boiler - Heating Switch']='On'
      end
    else
       if otherdevices['Hallway Thermostat'] - otherdevices_temperature['Hallway TempHum'] < 0 then
          if otherdevices['Boiler - Heating Switch'] == 'On' then
             commandArray['Boiler - Heating Switch']='Off'
          end
       end
    end
else
    if otherdevices['Boiler - Heating Switch'] == 'On' then
       commandArray['Boiler - Heating Switch']='Off' 
    end
end
 
return commandArray

 
During the autumn this proved very reliable. The heating was programmed to come on in the morning for a few hours to remove the morning chill and we used the heating boost in the evening when needed.
As the outside temperate dropped however we started running into issues…

Leave a Reply

Your email address will not be published. Required fields are marked *