Heating finally automated using HomeEasy HE105

For heating/cooling related questions in Domoticz

Moderator: leecollings

thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

Hi All,

Latest Version of the code updated : 10/03/2015 V0.4 <- Latest version updated to support new temperature set point switch. this removes the need for lots of the code and additional switches. Enjoy :)

I thought I'd share as I finally managed to get my heating hooked up to Domoticz. I know some of you already have something like this but I'm well pleased now I have it working. See below a screenshot and code for anyone who wants it. Have fun.

Hardware:
Woostesher Bosch CDi 30 - Link: http://www.worcester-bosch.co.uk/homeow ... sic-system
Homeeasy 105 Switch (Currently on sale - http://www.domoticz.com/forum/viewtopic.php?f=18&t=4028)
rfxtrx & pi :)

Image

Latest Version of the code updated : 08/11/2015 V0.4.1

Code: Select all

-----------------------------------------------------------------------------------------------
-- Heating Control
-- Version 0.4.1
-- Author - Martin Rourke

-- This library is free software: you can redistribute it and/or modify it under the terms of 
-- the GNU Lesser General Public License as published by the Free Software Foundation, either 
-- version 3 of the License, or (at your option) any later version. This library is distributed
-- in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
-- Public License for more details. You should have received a copy of the GNU Lesser General 
-- Public License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------
-- Setup
-----------------------------------------------------------------------------------------------
-- To use this script you need to have a few devices already setup in Domoticz
-- 1. A physical switch to operate (On/Off Switch)
-- 2. A physical temperature sensor (Temperature)
-- 3. A virtual switch to tun on and off the heating (On/Off Switch)
-- 4. A virtual switch to set the target temperature (Temperature)
-- 5. Define a User Variable as 'Debug', Integer and set to 1 or 0 to show/hide entries in the log

-----------------------------------------------------------------------------------------------
-- 1. A physical switch to operate (On/Off Switch)
-----------------------------------------------------------------------------------------------
local physicalheater = 'Heating House (Boiler)'

-----------------------------------------------------------------------------------------------
-- 2. A physical temperature sensor (Temperature)
-----------------------------------------------------------------------------------------------
-- Future improvement will be to define more than one temperature sensor and assume an average 
-----------------------------------------------------------------------------------------------
local currenttemperature = 'Temperature Bedroom'

-----------------------------------------------------------------------------------------------
-- 3. A virtual switch to tun on and off the heating (On/Off Switch)
-----------------------------------------------------------------------------------------------
local virtualheater = 'Heating House'

-----------------------------------------------------------------------------------------------
-- 4. A virtual switch to set the target temperature (Temperature)
-- Assumes you are using a dummy switch "Thermostat Setpoint" to move temperature up and down
-----------------------------------------------------------------------------------------------
local targettemperature = 'Thermostat House'

-----------------------------------------------------------------------------------------------
-- 5. UserVariable - Set debug to 1 for testing. 0 for live running.
-----------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------
-- OPTIONS
-----------------------------------------------------------------------------------------------
-- Defines the amount the target temperature will move when the up and down buttons are pressed
-----------------------------------------------------------------------------------------------
local pitch= 1

-----------------------------------------------------------------------------------------------
-- The tolerance for the thermostat. So the heating doesn't continually turn on and off around 
-- the target temperature this specifies the tolerance before any action is taken.
-----------------------------------------------------------------------------------------------
local tolerance = 0.5 -- NOT BEING USED!!!!!

-----------------------------------------------------------------------------------------------
-- After this time the heating will automatically turn off as a temperature was not detected 
-- from the temperature sensor. this helps protect against the heating being left on all the 
-- time if the signal is lost.
-----------------------------------------------------------------------------------------------
local lostsignaltime = 3600 -- 60 minutes

-----------------------------------------------------------------------------------------------
-- Helps protect against multiple quick changes to the physical switch
-----------------------------------------------------------------------------------------------
local heatercommanddelay = 30 -- 30 seconds

-----------------------------------------------------------------------------------------------
-- Repeats the On or Off command after a set time for devices that don't have a handshake
-- Should always be bigger than heatercommanddelay
-----------------------------------------------------------------------------------------------
local heaterrepeatdelay = 60 -- 1 minute

-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- NOTHING SHOULD NEED TO CHANGE BELOW THIS LINE
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------

local thermostatchgnagedetected = 0 

commandArray = {}
function debuglog (s)
	if uservariables["Debug"] == 1 then print("DEBUG - THERMOSTAT " .. physicalheater .. s) end
	return true
end

function timedifference (s)
  year = string.sub(s, 1, 4)
  month = string.sub(s, 6, 7)
  day = string.sub(s, 9, 10)
  hour = string.sub(s, 12, 13)
  minutes = string.sub(s, 15, 16)
  seconds = string.sub(s, 18, 19)
  t1 = os.time()
  t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
  difference = os.difftime (t1, t2)
  return difference
end

-----------------------------------------------------------------------------------------------
-- Controls the heating based on the target and current temperatures
-----------------------------------------------------------------------------------------------

-- Is the heating scheduled to be on?
   if (otherdevices[virtualheater]=='On') then
	debuglog('Heating - Heating Is Scheduled To Be On: ' .. virtualheater )

	-- what is the target temperature?
	target = tonumber(otherdevices_svalues[targettemperature])

	-- test to see if we can still see the thermostat. If not force the heating off
	--debuglog('Heating - Control Switch: ' .. tostring(timedifference(otherdevices_lastupdate[currenttemperature])) .. ' LostSignalTime: ' .. tostring(lostsignaltime))
		
	if ( timedifference(otherdevices_lastupdate[currenttemperature]) > lostsignaltime ) then
	
		debuglog('Heating - WARNING: Last seen temperature sensor: '.. currenttemperature ..' ' .. tostring(otherdevices_lastupdate[currenttemperature]))
		debuglog('Heating - WARNING: Signal Lost with temperature sensor for over '.. lostsignaltime ..' seconds: '.. currenttemperature)
		debuglog('Heating - WARNING: forcing Heating OFF : '.. physicalheater) 
			
		if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay) then -- checks to see if the command needs to be repeated
			if (otherdevices[physicalheater]=='Off') then
				debuglog('Heating - WARNING - Turning Physical Heater On: '.. physicalheater)
			else
				debuglog('Heating - WARNING - Turning Physical Heater On (Repeat Command): '.. physicalheater)
			end
			commandArray[physicalheater] = 'On'
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
		end
	
	else
	
		debuglog('Heating - Last seen temperature sensor: '.. currenttemperature ..' ' .. tostring(otherdevices_lastupdate[currenttemperature]))
		
		-- What is the current temperature?
		--debuglog('STRING 1 Current - Return Value : ' .. tostring(otherdevices_svalues[currenttemperature]))
		--debuglog('STRING 2 Current - Value Type : ' .. type(otherdevices_svalues[currenttemperature]))
		--debuglog('STRING 3 Current - First Element : ' .. string.gmatch(otherdevices_svalues[currenttemperature], '([^;]+)')(1))
		
		-- As some temperature devices also return other values as humidity this assumes the first value is the temperature in all cases
		current = tonumber(string.gmatch(otherdevices_svalues[currenttemperature], '([^;]+)')(1))

		debuglog('Heating - Target: ' .. tostring(target) .. ' Current: ' .. tostring(current))

		if( timedifference(otherdevices_lastupdate[physicalheater]) > heatercommanddelay ) then -- checks to see if the heater has been turned off recently
			debuglog('Heating - Enough time has passed since last change to switch: '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
			if (current < target) then
				debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='Off') then
						debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater On (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'On'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end
			else
				debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='On') then
						debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater Off (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'Off'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end
			end
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
		end
	end
   else
		debuglog('Heating - Turning Heating Off As Scheduled To Be Off')   
		if( timedifference(otherdevices_lastupdate[physicalheater]) > heatercommanddelay ) then 		-- NEED SOMETHING IN HERE TO STOP TURNING ON AND OFF CONSTANTLY
			debuglog('Heating - Enough time has passed before issuing command to switch: '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='On') then
						debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater Off (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'Off'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end	
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
		end
	
   end
-- Version 0.3

Code: Select all

-----------------------------------------------------------------------------------------------
-- Heating Control
-- Version 0.3
-- Author - Martin Rourke

-- This library is free software: you can redistribute it and/or modify it under the terms of 
-- the GNU Lesser General Public License as published by the Free Software Foundation, either 
-- version 3 of the License, or (at your option) any later version. This library is distributed
-- in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
-- Public License for more details. You should have received a copy of the GNU Lesser General 
-- Public License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-----------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------
-- Setup
-----------------------------------------------------------------------------------------------
-- To use this script you need to have a few devices already setup in Domoticz
-- 1. A physical switch to operate (On/Off Switch)
-- 2. A physical temperature sensor (Temperature)
-- 3. A virtual switch to tun on and off the heating (On/Off Switch)
-- 4. A virtual switch to set the target temperature (Temperature)
-- 5. A virtual switch to move the target temperature up (Push Button)
-- 6. A virtual switch to move the target temperature down (Push Button)

-----------------------------------------------------------------------------------------------
-- 1. A physical switch to operate (On/Off Switch)
-----------------------------------------------------------------------------------------------
local physicalheater = 'Heating House (Boiler)'
local physicalheateridx = 181

-----------------------------------------------------------------------------------------------
-- 2. A physical temperature sensor (Temperature)
-----------------------------------------------------------------------------------------------
-- This is the name and idx of the REAL temperature sensor you want to use to monitor the 
-- temperature. Virtual Temperature Sensor - name and id
-----------------------------------------------------------------------------------------------
-- Future improvement will be to define more than one temperature sensor and assume an average 
-----------------------------------------------------------------------------------------------
--local currenttemperature = 'Temperature Kitchen'
--local currenttemperatureidx = 3
--local currenttemperature = 'Temperature Hall'
--local currenttemperatureidx = 111
local currenttemperature = 'Temperature Bedroom'
local currenttemperatureidx = 2

-----------------------------------------------------------------------------------------------
-- 3. A virtual switch to tun on and off the heating (On/Off Switch)
-----------------------------------------------------------------------------------------------
local virtualheater = 'Heating House'
local virtualheateridx = 178

-----------------------------------------------------------------------------------------------
-- 4. A virtual switch to set the target temperature (Temperature)
-----------------------------------------------------------------------------------------------
local targettemperature = 'Thermostat House'
local targettemperatureidx = 172

-----------------------------------------------------------------------------------------------
-- 5. A virtual switch to move the target temperature up (Push Button)
-----------------------------------------------------------------------------------------------
local remoteup = 'Thermostat House Up'

-----------------------------------------------------------------------------------------------
-- 6. A virtual switch to move the target temperature down (Push Button)
-----------------------------------------------------------------------------------------------
local remotedown = 'Thermostat House Down'

-----------------------------------------------------------------------------------------------
-- OPTIONS
-----------------------------------------------------------------------------------------------
-- Defines the amount the target temperature will move when the up and down buttons are pressed
-----------------------------------------------------------------------------------------------
local pitch= 1

-----------------------------------------------------------------------------------------------
-- The tolerance for the thermostat. So the heating doesn't continually turn on and off around 
-- the target temperature this specifies the tolerance before any action is taken.
-----------------------------------------------------------------------------------------------
local tolerance = 0.5 -- NOT BEING USED!!!!!

-----------------------------------------------------------------------------------------------
-- After this time the heating will automatically turn off as a temperature was not detected 
-- from the temperature sensor. this helps protect against the heating being left on all the 
-- time if the signal is lost.
-----------------------------------------------------------------------------------------------
local lostsignaltime = 3600 -- 60 minutes

-----------------------------------------------------------------------------------------------
-- Helps protect against multiple quick changes to the physical switch
-----------------------------------------------------------------------------------------------
local heatercommanddelay = 30 -- 30 seconds

-----------------------------------------------------------------------------------------------
-- Repeats the On or Off command after a set time for devices that don't have a handshake
-- Should always be bigger than heatercommanddelay
-----------------------------------------------------------------------------------------------
local heaterrepeatdelay = 600 -- 1 minute

-----------------------------------------------------------------------------------------------
-- Set debug to 1 for testing. 0 for live running.
-----------------------------------------------------------------------------------------------
debug = 0 -- Stored as variable now

-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- NOTHING SHOULD NEED TO CHANGE BELOW THIS LINE
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------

local thermostatchgnagedetected = 0 

commandArray = {}
function debuglog (s)
    --if debug == 1 then print(s) end
	--print "DEBUG"
	if uservariables["Debug"] == 1 then print("DEBUG - THERMOSTATHOUSE " .. " " .. s) end
	return true
end

function timedifference (s)
  year = string.sub(s, 1, 4)
  month = string.sub(s, 6, 7)
  day = string.sub(s, 9, 10)
  hour = string.sub(s, 12, 13)
  minutes = string.sub(s, 15, 16)
  seconds = string.sub(s, 18, 19)
  t1 = os.time()
  t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
  difference = os.difftime (t1, t2)
  return difference
end


-----------------------------------------------------------------------------------------------
-- Actions for moving the target temperature up and down
-----------------------------------------------------------------------------------------------
if (devicechanged[remoteup] or devicechanged[remotedown]) then
   target = tonumber(otherdevices_svalues[targettemperature])
   debuglog('Thermostat - Target Temperature: ' .. tostring(target))
   if (devicechanged[remoteup]=='On') then
       commandArray['UpdateDevice'] = targettemperatureidx .. '|0|' .. tostring(target+pitch)
       commandArray[remoteup] = 'Off'
	   debuglog('Thermostat - Target Temperature Up by : ' .. tostring(pitch) .. ' to : ' .. tostring(target+pitch))
   elseif (devicechanged[remotedown]=='On') then
       commandArray['UpdateDevice'] = targettemperatureidx .. '|0|' .. tostring(target-pitch)
       commandArray[remotedown] = 'Off'
       debuglog('Thermostat - Target Temperature Down by : ' .. tostring(pitch) .. ' to : ' .. tostring(target-pitch))
   end
else
	target = tonumber(otherdevices_svalues[targettemperature])
	debuglog('Thermostat - Target Temperature: ' .. tostring(target) .. '')
end

-----------------------------------------------------------------------------------------------
-- Controls the heating based on the target and current temperatures
-----------------------------------------------------------------------------------------------

-- Is the heating scheduled to be on?
   if (otherdevices[virtualheater]=='On') then
	debuglog('Heating - Heating Is Scheduled To Be On: ' .. virtualheater )

	-- what is the target temperature?
	target = tonumber(otherdevices_svalues[targettemperature])

	-- test to see if we can still see the thermostat. If not force the heating off
	--debuglog('Heating - Control Switch: ' .. tostring(timedifference(otherdevices_lastupdate[currenttemperature])) .. ' LostSignalTime: ' .. tostring(lostsignaltime))
		
	if ( timedifference(otherdevices_lastupdate[currenttemperature]) > lostsignaltime ) then
	
		debuglog('Heating - WARNING: Last seen temperature sensor: '.. currenttemperature ..' ' .. tostring(otherdevices_lastupdate[currenttemperature]))
		debuglog('Heating - WARNING: Signal Lost with temperature sensor for over '.. lostsignaltime ..' seconds: '.. currenttemperature .. ' (IDX: '.. currenttemperatureidx ..')')
		debuglog('Heating - WARNING: forcing Heating OFF : '.. physicalheater) 
		-- commandArray['SendNotification']='Test' -- SEND NOTIFICATION
			
		if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay) then -- checks to see if the command needs to be repeated
			if (otherdevices[physicalheater]=='Off') then
				debuglog('Heating - WARNING - Turning Physical Heater On: '.. physicalheater)
			else
				debuglog('Heating - WARNING - Turning Physical Heater On (Repeat Command): '.. physicalheater)
			end
			commandArray[physicalheater] = 'On'
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
		end
	
	else
	
		debuglog('Heating - Last seen temperature sensor: '.. currenttemperature ..' ' .. tostring(otherdevices_lastupdate[currenttemperature]))
		
		-- what is the current temperature?
		--debuglog('STRING 1 Current - Return Value : ' .. tostring(otherdevices_svalues[currenttemperature]))
		--debuglog('STRING 2 Current - Value Type : ' .. type(otherdevices_svalues[currenttemperature]))
		--debuglog('STRING 3 Current - First Element : ' .. string.gmatch(otherdevices_svalues[currenttemperature], '([^;]+)')(1))
		
		-- As some temperature devices also return other values as humidity this assumes the first value is the temperature in all cases
		current = tonumber(string.gmatch(otherdevices_svalues[currenttemperature], '([^;]+)')(1))

		debuglog('Heating - Target: ' .. tostring(target) .. ' Current: ' .. tostring(current))

		if( timedifference(otherdevices_lastupdate[physicalheater]) > heatercommanddelay ) then -- checks to see if the heater has been turned off recently
			debuglog('Heating - Enough time has passed since last change to switch: '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
			if (current < target) then
				debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='Off') then
						debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater On (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'On'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end
			else
				debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='On') then
						debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater Off (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'Off'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end
			end
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
		end
	end
   else
		debuglog('Heating - Turning Heating Off As Scheduled To Be Off')   
		if( timedifference(otherdevices_lastupdate[physicalheater]) > heatercommanddelay ) then 		-- NEED SOMETHING IN HERE TO STOP TURNING ON AND OFF CONSTANTLY
			debuglog('Heating - Enough time has passed before issuing command to switch: '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
				if( timedifference(otherdevices_lastupdate[physicalheater]) > heaterrepeatdelay or devicechanged[remoteup] or devicechanged[remotedown] or devicechanged[virtualheater]) then -- checks to see if the command needs to be repeated
					if (otherdevices[physicalheater]=='On') then
						debuglog('Heating - Turning Physical Heater Off: '.. physicalheater)
					else
						debuglog('Heating - Turning Physical Heater Off (Repeat Command): '.. physicalheater)
					end
					commandArray[physicalheater] = 'Off'
				else
					debuglog('Heating - INFO: Not enough time has passed before issuing repeat command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heaterrepeatdelay .. ' seconds')
				end	
		else
			debuglog('Heating - INFO: Not enough time has passed before issuing command to switch: Only '.. timedifference(otherdevices_lastupdate[physicalheater]) .. ' seconds out of ' .. heatercommanddelay .. ' seconds')
		end
	
   end
Wiring (Get this checked by someone qualified. Just sharing for info :) special thanks goes out to my mate Kenny who helped me here :) )

This is the inside of the Homeeasy HE105 and what I hooked it up to on the Boiler (see the boiler manual for info on the other connections). So once I hooked this up I left the digistat that came with the boiler attached but just turned it all the way up to max so Domoticz can control the heating and I don't have to worry too much about connecting everything back up when I move out.

Image
Last edited by thebeetleuk on Sunday 08 November 2015 1:13, edited 3 times in total.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by bbqkees »

It looks like you are not using any hysteresis around the setpoint. The way you have it now is that it might produce a load of on/off moments when f.i. a breeze of cold air passes by the temperature sensor.

You need to build in something like a check for a change in temperature in a range and during a time interval.

Also if you lose the temperature sensor connection while the heater is on, it will continue to heat forever because your setpoint is never reached.
This not a very robust system yet.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

bbqkees wrote:It looks like you are not using any hysteresis around the setpoint. The way you have it now is that it might produce a load of on/off moments when f.i. a breeze of cold air passes by the temperature sensor.

You need to build in something like a check for a change in temperature in a range and during a time interval.
This is what the following variable is used for. I think everyone will have different levels of fluctuation so you would want to set how big this is yourself. I take your point about the time interval and I will build that in as a setting in a future version.

Code: Select all

-----------------------------------------------------------------------------------------------
-- The tolerance for the thermostat. So the heating doesnt continually turn on and off around 
-- the target temperature this specifies the tolerance before any action is taken.
-----------------------------------------------------------------------------------------------
local tolerance = 0.5
bbqkees wrote:Also if you lose the temperature sensor connection while the heater is on, it will continue to heat forever because your setpoint is never reached.
This not a very robust system yet.
I did think about this at the time of writing but thought that the code would operate just like my wireless thermostat. At the moment if this fails after the heating is turned on then I think it would just stay on if the signal is lost. Saying that I'm guessing here as it might turn off if it's not had a signal after a set amount of time. something else to build in.

Thanks for the points. Ill get to work on some updates :)

Motion Sensor
I also have another script to act as a pre
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by bbqkees »

You indeed declared a variable 'tolerance' but you're not using it in the code you posted.

A 'real' thermostat has the advantage of a built-in thermometer which is used internally to turn the boiler/heater on or off. Your setup includes a separate wireless sensor and the decision is made by Domoticz.
The communication can be lost when f.i. the batteries run out.

What might be an idea and I do not know if if it will actually work because I don't know what other hardware you use but maybe you can put your original thermostat in series with the HomeEasy switch.
If you would set the original thermostat to say 25 degrees, it would act as a fail-safe because it will always break the HomeEasy connection at that point.
So no matter if the wireless connection is lost, Domoticz fails, your script is faulty etc and because of that the heater keeps working unintentionally, it will automatically shut off when 25 degrees is reached when the thermostat breaks the connection at that temperature.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

All good points. I didn't actually notice I hadn't used the tolerance value in the code :oops: . Obviously too keen to get things up and running. I'll get this sorted out tomorrow.

I've now implemented the other feature you mentioned earlier to ensure the temperature sensor has been seen in a certain amount of time. If not then it forces the heating off.

I do like the idea of running the additional thermostat in series with the HE105. At the moment I have the original digistat plugged into the boiler (see pic below as an example). So I was hoping, as you mentioned, that this would act as my backup. It would appear however this doesn't seem to be wired up in series and just overrides my HE105 :? Not ideal. Looks like I'll need to disconnect the existing one and buy another external thermostat to connect up in series.

Image
Image

Thanks for the comments. :)
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by bbqkees »

An old mercury filled type Honeywell round would certainly do the trick.

Your thermostat is too complex. It might also be an OpenTherm type, which will not work.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

I think I may have this working properly now. The code looks fine (I'll need to update that as its different from the one above now). That said I can see the HE105 doesn't seem to receive the off command some of the time. This could be a side effect of using Homeeasy for something like this as its fire and forget as opposed to getting a confirmation that the switch is actually on or off.

Can you give an example of one of these that can be controlled by the rfxtrx?
An old mercury filled type Honeywell round would certainly do the trick.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
b_weijenberg
Posts: 518
Joined: Friday 12 July 2013 18:13
Target OS: -
Domoticz version:
Location: Netherlands
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by b_weijenberg »

To improve the reliability transmit the current state On or Off every 5 minutes.
RFX-433, RFX-433EMC, RFX-868
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

b_weijenberg wrote:To improve the reliability transmit the current state On or Off every 5 minutes.
Good idea and I have now done this with success. :)
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
User avatar
pieman
Posts: 5
Joined: Thursday 23 October 2014 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Cyprus
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by pieman »

thebeetleuk wrote:
b_weijenberg wrote:To improve the reliability transmit the current state On or Off every 5 minutes.
Good idea and I have now done this with success. :)
Thanks for your write up on the HE105. Are you able to provide the latest version of your code?
I have an unopened HE105 and have Domoticz running on my Raspberry Pi.

The part I am missing is the interface between them and I believe you are using the RFXtrx433. Did you originally need a HE100 / HE101 remote control to decode the RF signal? I would be looking to use an Arduino 'home brew' RF transmitter / receiver 'kit'. Do you think this is possible or did the RFXtrx433 do all the decoding / interfacing for you?
I have various pieces of hardware and software for decoding RF but I'm worried that I don't currently have a remote control for the HE105 to decode.
Smart IOT Devices: https://thechariot.co.uk/
User avatar
pieman
Posts: 5
Joined: Thursday 23 October 2014 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Cyprus
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by pieman »

I received my HE100 'Ultimate' remote control a few days. A first it was an absolute nightmare trying to get the HE100 to switch on the HE105 but finally the two HE105' s are up and running. The documentation that comes with the HE100 and HE105 is dreadful.

The 5 dip switches on the HE105 are all set as on by default which from my reading of the literature means code 32 but references indicate it should be 0. Tried lots of combinations and finally all dip switches are paired with the code of 0. First HE105 took me ages to set up but the second was just the time it took to wire it up.

Despite the earlier posts in this thread I couldn't get zero voltage to work but when I was at school zero voltage meant 'not on'. So I have retained the red make up cable across the live feed. All seems fine in this mode.

For forum members that have the HE105 I have a few questions:

1. Does the HE105 have an inbuilt thermostat or would I need a separate unit if I wanted to do anything more than timer plus manual on and off?
2. Reading the dreadful guide for the HE105 it makes reference to default temperatures and timer settings when power is reset. It shows 5 available programs available for 5 weekdays and the 2 days at the weekend. For example 6am temp 21 degrees, 8am 17 degrees etc. The HE100 controller appears to have 16 available programs rather than the 5 indicated in the manual. Does the temperature settings in the manual therefore indicate the device has an inbuilt thermostat but the HE100 doesn't appear to have temperature settings for the HE105 other than the 'dimmer' effect.

I currently have a Raspberry Pi turning the HE105 on and off but I have more work to do to fine tune this.
Smart IOT Devices: https://thechariot.co.uk/
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by ThinkPad »

Topic moved to 'Functionalities > Heating' section.
I am not active on this forum anymore.
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

Code update with latest version. V0.3

Enjoy and feedback is always welcome.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

Firstly, sorry it took so long to reply. I've only just spotted your post :)
pieman wrote:I received my HE100 'Ultimate' remote control a few days. A first it was an absolute nightmare trying to get the HE100 to switch on the HE105 but finally the two HE105' s are up and running. The documentation that comes with the HE100 and HE105 is dreadful.
I agree. I had to get a friend in electronics to help me out.
pieman wrote:1. Does the HE105 have an inbuilt thermostat or would I need a separate unit if I wanted to do anything more than timer plus manual on and off?
No. In the code I used I had an external thermostat. I use the oregon ones as they are very reliable in my experience.
pieman wrote:2. Reading the dreadful guide for the HE105 it makes reference to default temperatures and timer settings when power is reset. It shows 5 available programs available for 5 weekdays and the 2 days at the weekend. For example 6am temp 21 degrees, 8am 17 degrees etc. The HE100 controller appears to have 16 available programs rather than the 5 indicated in the manual. Does the temperature settings in the manual therefore indicate the device has an inbuilt thermostat but the HE100 doesn't appear to have temperature settings for the HE105 other than the 'dimmer' effect.
In short, you might as well throw the manual away. Its useless. I don't use the HE100 remote as its all controlled through the Pi and Domoticz. The updated code has a short section on what switched you need to setup in order to get this to work as a thermostatic control (provided you have a temperature sensor).
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
jkimmel
Posts: 129
Joined: Monday 25 November 2013 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Mallorca
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by jkimmel »

What is the purpose of using a HE105?
Wouldn't any other wireless relay do the job?
Rfxcom
Raspi 4
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

Yes any relay built for this purpose would do just fine. After all its just a switch.

To be honest I just used the HE105 so I could have a backup of using a HE remote should something go wrong. I'm also not an electronics person and would rather buy something that's purpose build when it comes to mains power :)

I just wished Id got mine when it was £5 and not £30! :)
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by deennoo »

Your digistat is a drayton/Eberle/Invensys/Schneider-electric product, simple but usefull, i'm working on mine to hack his 868mhz (433 for UK) connection, surely your script can work, did you add the time learning ?
On the first time of his life this thermostat learn how many time is needed to set temp selected, and this always learning.

Set 20 at 8:00 OK but if you start from 16 and if there is 20 at 9 when you left, that inutil.

They got a prototype using z wave but dont plan to sell it.

This summer will be available the web connected MySeries, wired or RF.

I'm waiting a sample for french market
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
pieman
Posts: 5
Joined: Thursday 23 October 2014 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Cyprus
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by pieman »

Hi thebeetleuk,

Thank you for your replies. After several weeks working with the HE105 I think I now know what it does, rather than what the manual states it does :lol:

You wrote:

Code update with latest version. V0.3

Enjoy and feedback is always welcome.


Where do I obtain a copy of V0.3 from?

Edit, found V0.3 in your earlier post, thanks. I will take a look and get back to you when I have tested it. Once again, thanks.
Smart IOT Devices: https://thechariot.co.uk/
User avatar
pieman
Posts: 5
Joined: Thursday 23 October 2014 22:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Cyprus
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by pieman »

thebeetleuk,

Do you control your HE105 with the RFXtrx433?
Smart IOT Devices: https://thechariot.co.uk/
thebeetleuk
Posts: 115
Joined: Saturday 21 December 2013 23:50
Target OS: Linux
Domoticz version:
Location: Scotland
Contact:

Re: Heating finally automated using HomeEasy HE105

Post by thebeetleuk »

pieman wrote:thebeetleuk,

Do you control your HE105 with the RFXtrx433?
Yes. I do.
My Setup: Pi, RFXtrx433, HomeEasy: 13 Dimmers & 4 Sockets, 2 motion-sensors, 3 magnetic switches, 1 OWL Electricity Sensor, 3 Oregon Temp Sensor.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest