Sadly my boiler doesn't support OTGW, but I didn't turn my heating off during summer. I meant to but it slipped my mind. The heating stayed off and a couple of weeks ago I thought "Ooh it's chilly... time to fire up the boiler" and it actually came on that evening by itself!!! I really do have a smart home... it read my mind!Skippiemanz wrote:Aaah i see! My next step is to control my boiler with the OTGW so i then also switch to Hot Water only during the summer months!
ELV Max! Heating control system
Moderator: leecollings
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
- Westcott
- Posts: 423
- Joined: Tuesday 09 December 2014 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: UK - Glos
- Contact:
Re: ELV Max! Heating control system
Window sensor update
Apparently the device type is in the M data, so in maxCmd_M it's dtype.
Looking in http://www.domoticaforum.eu/viewtopic.p ... 4&start=30
Apparently the device type is in the M data, so in maxCmd_M it's dtype.
Looking in http://www.domoticaforum.eu/viewtopic.p ... 4&start=30
The previous post explains the window sensor state -HeatingThermostat = 1,
HeatingThermostatPlus = 2,
WallMountedThermostat = 3,
ShutterContact = 4,
PushButton = 5
I found the Data for the window sensor.
Was my own fault, it is at the same place as the thermostate mode, so i thought i got thermostate values - but it was a window sensor
so if you take the same position of data that gives you the thermostate mode (auto, manu etc) the last two bits give "10" when the window is open.
Time to find out what 01 and 11 are
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: ELV Max! Heating control system
Ok Here goes nothing.. Tried to Copy/Change the part where the devices are beeing checkedWestcott wrote:Window sensor update![]()
Apparently the device type is in the M data, so in maxCmd_M it's dtype.
Looking in http://www.domoticaforum.eu/viewtopic.p ... 4&start=30
The previous post explains the window sensor state -HeatingThermostat = 1,
HeatingThermostatPlus = 2,
WallMountedThermostat = 3,
ShutterContact = 4,
PushButton = 5
I found the Data for the window sensor.
Was my own fault, it is at the same place as the thermostate mode, so i thought i got thermostate values - but it was a window sensor
so if you take the same position of data that gives you the thermostate mode (auto, manu etc) the last two bits give "10" when the window is open.
Time to find out what 01 and 11 are
Code: Select all
if (data_len == 13) then -- WallMountedThermostat (dev_type 3)
valve_pos = -1
s = hex:sub(17,18)
setpoint = tonumber(s,16) / 2
s = hex:sub(23,26)
temp = tonumber(s,16) / 10
dtype = "Thermostat"
elseif (data_len == 12) then -- HeatingThermostat (dev_type 1 or 2)
s = hex:sub(15,16)
valve_pos = tonumber(s,16)
s = hex:sub(17,18)
setpoint = tonumber(s,16) / 2
if (mode ~= 2) then
s = hex:sub(19,22)
temp = tonumber(s,16) / 10
else
temp = 0
end
dtype = "Valve"
elseif (data_len == 14) then -- ShutterContact (dev_type 4)
s = hex:sub(15,16)
valve_pos = tonumber(s,16)
s = hex:sub(17,18)
setpoint = tonumber(s,16) / 2
if (mode ~= 2) then
s = hex:sub(19,22)
temp = tonumber(s,16) / 10
else
temp = 0
end
dtype = "Contact"
end-
mvzut
- Posts: 443
- Joined: Thursday 12 November 2015 10:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
ELV Max! Heating control system
For the time being, I changed the script in the Wiki in such a way that it doesn't process "valves" which are actually door/window sensors. This only works if their names end with "-Sens". In this way, it won't try to update Domoticz devices for the sensor(s), which don't exist, so it shouldn't give these nil error messages anymore.blackdog65 wrote:As to your window sensors, although it would be nice to see them in Domoticz (long term), if they were taken out of the script (i.e. the script doesn't look for or read them) they would still function and work nice (short term).
Sean
Ideally we find a way to actually detect the device type and state of door/window sensors. I'm sure we'll eventually get there.
If this works, we should also update the text that explains the naming scheme.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: ELV Max! Heating control system
Tested and working! Thanks!(Again!)mvzut wrote:For the time being, I changed the script in the Wiki in such a way that it doesn't process "valves" which are actually door/window sensors. This only works if their names end with "-Sens". In this way, it won't try to update Domoticz devices for the sensor(s), which don't exist, so it shouldn't give these nil error messages anymore.blackdog65 wrote:As to your window sensors, although it would be nice to see them in Domoticz (long term), if they were taken out of the script (i.e. the script doesn't look for or read them) they would still function and work nice (short term).
Sean
Ideally we find a way to actually detect the device type and state of door/window sensors. I'm sure we'll eventually get there.
If this works, we should also update the text that explains the naming scheme.
- Westcott
- Posts: 423
- Joined: Tuesday 09 December 2014 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: UK - Glos
- Contact:
Re: ELV Max! Heating control system
Hi Skippiemanz,
They are indeed dev_type 4, but data format is the same as a valve - length 13.
It might be possible to guess from its data or name which device type it is.
One way would be to create a cross-reference table of device names and types at the top of the code.
More elegant would be to create this table by reading the M data.
My own controller code has a lookup table of Max ID vs Domoticz device names.
They are indeed dev_type 4, but data format is the same as a valve - length 13.
It might be possible to guess from its data or name which device type it is.
One way would be to create a cross-reference table of device names and types at the top of the code.
More elegant would be to create this table by reading the M data.
My own controller code has a lookup table of Max ID vs Domoticz device names.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
Re: ELV Max! Heating control system
I have been running the test script every minute for 2 days to plot the obtained temperatures and valve %.
As I do not have wall thermostats, this is relying on the temperature provided by the thermostat.
I believe that I read somewhere that this temperature is updated only after the valve % has changed so it does not get necessarily updated very often.
and this is what I observe when looking at the obtained data over 2 days. The temperature would suddenly jump from e.g., 19.1 to 20.9 (and when that happens I then see that the % has changed). Sometimes the temperature=0 for a while.
Has anyone had more success without wall thermostats ? or should I conclude that I need to buy these wall thermostats to have something reliable ?
Thanks
As I do not have wall thermostats, this is relying on the temperature provided by the thermostat.
I believe that I read somewhere that this temperature is updated only after the valve % has changed so it does not get necessarily updated very often.
and this is what I observe when looking at the obtained data over 2 days. The temperature would suddenly jump from e.g., 19.1 to 20.9 (and when that happens I then see that the % has changed). Sometimes the temperature=0 for a while.
Has anyone had more success without wall thermostats ? or should I conclude that I need to buy these wall thermostats to have something reliable ?
Thanks
- Westcott
- Posts: 423
- Joined: Tuesday 09 December 2014 17:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: UK - Glos
- Contact:
Re: ELV Max! Heating control system
Any type of temperature measuring device is fine, Z-wave, RFXtrx, RFlink, etc.
Doesn't have to be a Max.
Regarding window sensors, pretend they are valves, but just use the mode.
Doesn't have to be a Max.
Regarding window sensors, pretend they are valves, but just use the mode.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: ELV Max! Heating control system
Thansk! i will give this a try next week..Westcott wrote:Regarding window sensors, pretend they are valves, but just use the mode.
In the mean time, does anyone have the problem that the valve script wont turn on the CH_switch?
Code: Select all
2016-11-05 10:11:00.292 LUA: *** Heating Script Output ***
2016-11-05 10:11:00.292 LUA:
2016-11-05 10:11:00.293 LUA: Hal Room valve is open 100 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.293 LUA: Hal Room last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.293 LUA: Zolder RoomV valve is open 0 percent Setpoint temperature is 16.50C
2016-11-05 10:11:00.293 LUA: Zolder RoomV last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.293 LUA: Tijn Room valve is open 100 percent Setpoint temperature is 17.50C
2016-11-05 10:11:00.293 LUA: Tijn Room last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.293 LUA: Noa Room valve is open 100 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.293 LUA: Noa Room last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.293 LUA: Kamer RoomL valve is open 100 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.293 LUA: Kamer RoomL last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.294 LUA: Kamer RoomR valve is open 100 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.294 LUA: Kamer RoomR last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.294 LUA: Zolder RoomD valve is open 0 percent Setpoint temperature is 16.50C
2016-11-05 10:11:00.294 LUA: Zolder RoomD last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.294 LUA: Kantoor Room valve is open 54 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.294 LUA: Kantoor Room last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.294 LUA: Badkamer Room valve is open 53 percent Setpoint temperature is 18.50C
2016-11-05 10:11:00.294 LUA: Badkamer Room last seen 2016-11-05 10:10:01 Elapsed time 59
2016-11-05 10:11:00.294 LUA:
2016-11-05 10:11:00.295 LUA: Badkamer Room temperature is 18.50 Centigrade
2016-11-05 10:11:00.295 LUA: Badkamer Room last seen 2016-11-04 14:30:01 Elapsed time 70859
2016-11-05 10:11:00.295 LUA: Kamer RoomR temperature is 18.50 Centigrade
2016-11-05 10:11:00.295 LUA: Kamer RoomR last seen 2016-11-04 14:30:01 Elapsed time 70859
2016-11-05 10:11:00.295 LUA: Kantoor Room temperature is 18.50 Centigrade
2016-11-05 10:11:00.295 LUA: Kantoor Room last seen 2016-11-04 14:30:01 Elapsed time 70859
2016-11-05 10:11:00.295 LUA: Tijn Room temperature is 17.50 Centigrade
2016-11-05 10:11:00.295 LUA: Tijn Room last seen 2016-11-04 14:35:01 Elapsed time 70559
2016-11-05 10:11:00.295 LUA: Noa Room temperature is 18.50 Centigrade
2016-11-05 10:11:00.295 LUA: Noa Room last seen 2016-11-04 14:40:01 Elapsed time 70259
2016-11-05 10:11:00.296 LUA: Zolder RoomD temperature is 16.50 Centigrade
2016-11-05 10:11:00.296 LUA: Zolder RoomD last seen 2016-11-04 14:28:58 Elapsed time 70922
2016-11-05 10:11:00.296 LUA: Zolder RoomV temperature is 16.50 Centigrade
2016-11-05 10:11:00.296 LUA: Zolder RoomV last seen 2016-11-04 14:28:50 Elapsed time 70930
2016-11-05 10:11:00.296 LUA: Hal Room temperature is 18.50 Centigrade
2016-11-05 10:11:00.296 LUA: Hal Room last seen 2016-11-04 14:22:08 Elapsed time 71332
2016-11-05 10:11:00.296 LUA: Kamer RoomL temperature is 18.50 Centigrade
2016-11-05 10:11:00.296 LUA: Kamer RoomL last seen 2016-11-04 14:30:01 Elapsed time 70859
2016-11-05 10:11:00.296 LUA:
2016-11-05 10:11:00.296 LUA: Number of valves open more than 50% is 7 valves
2016-11-05 10:11:00.296 LUA: Highest valve open value is 100 percent
2016-11-05 10:11:00.297 LUA: Lowest thermostat reading is 16.5 Centigrade
2016-11-05 10:11:00.297 LUA:
2016-11-05 10:11:00.297 LUA: Current state - Boiler is OFF
2016-11-05 10:11:00.297 LUA: PercentMax (100%) Boiler On value (50%) Boiler Off value (30)%
2016-11-05 10:11:00.297 LUA: Number of valves open more than 50% is 7 valves. Minimum valves setting 2
2016-11-05 10:11:00.297 LUA: Maximum open value 100% Override value 99%
2016-11-05 10:11:00.297 LUA:*EDIT* Just saw that the script in the wiki was changed. If i use that one and the same problem. But ive i turn on the boilerswitch it wont turn it off so it doesn't switch the boiler
**EDIT 2** Just changed al the variables to hard switch names in the code and now everything works. So maybe has something to do with the quotes?
Code: Select all
- Script Variables
PercentMax = 0
TempMin = 100
ValveCount = 0
MissingDeviceCount = 0
SendAnEmail = false
HeatingSwitch = "Heating"
BoilerSwitch = "CH_Switch"
HolidaySwitch = "xx"Code: Select all
-- Perform logic
if printDebug == true then
-- view the settings to understand logic performance
print ("PercentMax (" .. PercentMax .. "%) " .. "Boiler On value (" .. BoilerOnPercent .. "%) " .. "Boiler Off value (" .. (BoilerOnPercent - HysterysisOffPercent) .. ")% ")
print ("Number of valves open more than " .. BoilerOnPercent .. "% is " .. ValveCount .." valves. Minimum valves setting " .. MinValves )
print ("Maximum open value " .. PercentMax .. "%" .. " Override value " .. ValvePercentOveride .."%")
print (" ")
end
if (otherdevices['HolidaySwitch'] == 'Off')then -- Not on holiday
if (otherdevices['HeatingSwitch'] == 'On')then -- It's time to heat the house
if (otherdevices['BoilerSwitch'] == 'Off') then --If a minimum of 'MinValves' valves are on by more that pre-set value BoilerOnPercent
if printDebug == true then
print ("Test passed - Boiler is OFF ")
end
if (PercentMax > BoilerOnPercent) then
if printDebug == true then
print ("Test passed - Radiators are open beyond the threshold ")
end
if (ValveCount >= MinValves) or (BoilerOnPercent >= ValvePercentOveride) then
if printDebug == true then
print ("Test passed - Either multiple valves are open or override count is reached ")
end
commandArray['BoilerSwitch']='On' -- turn on boiler
if printData == true then
print ("Command sent - Turn ON Boiler ")
end
end - blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
The is a typo as the "xx" should be as in the script but other than that, this is an exact copy of what I have running (including the typo) and it works for me.
I modded the script to have variables for the switches for ease, but I'm open to being wrong as I'm not a coder.
Code: Select all
HolidaySwitch = "xx"I modded the script to have variables for the switches for ease, but I'm open to being wrong as I'm not a coder.
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
Give it a run with
set to "True" and see what you get
Sean
Code: Select all
printData = false
printDebug = falseSean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: RE: Re: ELV Max! Heating control system
Already have that.blackdog65 wrote:Give it a run withset to "True" and see what you getCode: Select all
printData = false printDebug = false
Sean
Ik just says boiler off even when manually switched on. I also changed "xx" to holiday and made a corresponding virtual switch.
Ive got it running now by just hard wratten the switch names in the code.
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
One of the draw backs of the script is that t can't be over-ridden or boosted. When running correctly, if you switch the heat on (or off) manually, the next time the script runs it will set the heating how it thinks best. Having said that, when it runs properly you don't need to... and if Domoticz dies (i.e. raspberry sd card fried) the manual switches will work.
Having tried StellaZ and Smartwares (and choked on the price of Danfos and EvoHome) I still think this is by far the best so far
Having tried StellaZ and Smartwares (and choked on the price of Danfos and EvoHome) I still think this is by far the best so far
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: ELV Max! Heating control system
Dont get me wrong! I love the stuff youve created!
Maybe this causes my Problems https://r.tapatalk.com/shareLink?url=ht ... are_type=t
Events not working after update to 3.5837
Maybe this causes my Problems https://r.tapatalk.com/shareLink?url=ht ... are_type=t
Events not working after update to 3.5837
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
I'm on V3.5862 and it's running sweet
BTW, I didn't "create" anything... I'm the "King of Copy & Paste"
Sean
BTW, I didn't "create" anything... I'm the "King of Copy & Paste"
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
-
daveabbott007
- Posts: 7
- Joined: Friday 03 June 2016 16:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: ELV Max! Heating control system
Skippiemanz / all, Hi, Firstly Great work all, i have been watching this develop and love all the work you guys have been putting in, my system is not fully working yet (not getting temp or setpoint readings form MAX to Domoticz, script is reading them but domoticz not updating. Valves are fine) but its certainly getting there.Skippiemanz wrote: In the mean time, does anyone have the problem that the valve script wont turn on the CH_switch?
i noticed the same problem and have manged to fix it in my version of the script, NOTE: i am running the script via the Events LUA (Time) page not in a file in the LUA folder (not sure if it makes a difference).
The 2 problems i noticed were,
1. around line 26- TempMin = 100, should be TempMin = 10 (or whatever you want for your lowest temp?)
2. loads of instances of hard coded device names instead of variable name I.E. 'BoilerSwitch' instead of BoilerSwitch,
Here is my adjusted code if you want to try it,
Code: Select all
-- script_time_Heating Valves.lua
-- Version 1.9 27/10/16
-- Script to read the % open of radiator valves
-- All radiator valves are labelled "<room name>-Rad"
-- search is made for "-Rad" to indicate a radiator valve
-- If found it will be interrogated for % open value
-- Thermostat are named <room name>-Stat so a search is made for "-Stat" to indicate thermostats
-- If found it will be interrogated for temperature value
-- If demand is greater than BoilerOnPercent value then fire up boiler
-- If demand is less than BoilerOnPercent minus HysterysisOffPercent then switch off boiler
-- Preset Values
BoilerOnPercent = 30 -- percentage valve open at which the boiler will be turned on
HysterysisOffPercent = 20 -- percentage below BoilerOnPercent to switch off the boiler
MinValves = 2 -- Number of Valves that need to be open before boiler is turned on
ValvePercentOveride = 75 -- Percentage value of valve open required to override MinValves value (one room is very cold)
HolidayMinTemp = 10 -- Minimum room temperature before boiler is turned on during holiday period
HolidayHysterysisTemp = 2 -- Value to increase house temperature by while in holiday mode if boiler is turned on due to low temperatures
MissingDevicesTime = 86400 -- Value in seconds to allow before reporting a device has not been updated
email = "[email protected]" -- email address for warnings
-- Script Variables
PercentMax = 0
TempMin = 10
ValveCount = 0
MissingDeviceCount = 0
SendAnEmail = false
HeatingSwitch = "Heating"
BoilerSwitch = "CH_Switch"
HolidaySwitch = "Holiday"
-- Set printing to log options (true / false)
printData = true
printDebug = false
-- Get current date & time
t1 = os.time()
local currentDate = os.date("*t"); -- sets up currentDate.[table]
-- (currentDate.year [full], .month [1-12], .day [1-31], .hour [0-23], .min [0-59], .sec [0-59], .wday [0-6 {Sun-Sat}])
sCurrentTime = currentDate.year .. "-" .. currentDate.month .. "-" .. currentDate.day .. " " .. currentDate.hour .. ":" .. currentDate.min .. ":" .. currentDate.sec
function TimeElapsed(s) -- expects date & time in the form of 2010-01-23 12:34:56
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 -- in seconds
end
commandArray = {}
-- print blank line in log
if printData == true then
print (" ")
print (" *** Heating Script Output ***")
print (" ")
end
-- Get Data from Radiator Valves
for i, v in pairs(otherdevices) do -- Get all devices in the database
v = i:sub(-4,-1) -- Grab the last four characters of the device name
if (v == '-Rad') then -- are the last four characters "-Rad"? If so we have a Radiator Valve
RoomName = i:sub(1,-5) -- Get the rest of the name, which will be the room name
sSetTempValue = otherdevices_svalues[RoomName..'-Stat']
sValvePercentOpen = otherdevices_svalues[i]
sLastUpdateTime = otherdevices_lastupdate[i]
sElapsedTime = TimeElapsed(otherdevices_lastupdate[i])
message = RoomName .. " valve is open " .. sValvePercentOpen .. " percent " .. " Setpoint temperature is " .. sSetTempValue .. "C" -- for debug
message2 = RoomName .. " last seen " .. sLastUpdateTime .. " Elapsed time " .. sElapsedTime
if printData == true then
print (message)
print (message2)
end
-- check for missing devices
if sElapsedTime > MissingDevicesTime then
SendAnEmail = false
MissingDeviceCount = MissingDeviceCount + 1
end
-- get the % value of the most open Radiator Valve
if tonumber(sValvePercentOpen) > PercentMax then
PercentMax = tonumber(sValvePercentOpen)
end
-- Count the number of valves that are open more than BoilerOnPercent
if tonumber(sValvePercentOpen) >= BoilerOnPercent then
ValveCount = ValveCount + 1
end
end
end
if printData == true then
print (" ")
end
-- Get Data from Thermostats
for i, v in pairs(otherdevices) do -- Get all devices in the database
v = i:sub(-5,-1) -- Grab the last five characters of the device name
if (v == '-Stat') then -- are the last five characters "-Stat "? If so we have an EQ-3 Thermostat
RoomName = i:sub(1,-6) -- Get the rest of the name, which will be the room name
sTemp = otherdevices_svalues[i] -- get the temperature
sLastUpdateTime = otherdevices_lastupdate[i]
sElapsedTime = TimeElapsed(otherdevices_lastupdate[i])
message = RoomName.." temperature is " .. sTemp .. " Centigrade " -- for debug
message2 = RoomName .. " last seen " .. sLastUpdateTime .. " Elapsed time " .. sElapsedTime
if printData == true then
print(message)
print(message2)
end
-- get the lowest temperature of the thermostats
if tonumber(sTemp) < TempMin then
TempMin = tonumber(sTemp)
end
-- check for missing devices
if sElapsedTime > MissingDevicesTime then
SendAnEmail = true -- change this to false if you do not require emails to be sent
MissingDeviceCount = MissingDeviceCount + 1
end
end
end
if printData == true then
print (" ")
print ("Number of valves open more than " .. BoilerOnPercent .. "% is " .. ValveCount .." valves")
print("Highest valve open value is " .. PercentMax .." percent ")
print("Lowest thermostat reading is " .. TempMin .." Centigrade ")
print (" ")
end
if printData == true then
if (otherdevices[BoilerSwitch] == 'On')then
print ("Current state - Boiler is ON ")
else
print ("Current state - Boiler is OFF ")
end
end
-- Check the elapsed time and email if overdue
if (SendAnEmail == true) then
print (" ")
print("Heating Script: missing device email sent to " .. (email) );
notifyString = os.date("Domoticz Alert # The current time is %X on %A Lost contact with " .. MissingDeviceCount .. " Heating script devices, check if Max!Buddy is running. #") .. (email)
commandArray['SendEmail'] = notifyString
end
-- Perform logic
if printDebug == true then
-- view the settings to understand logic performance
print ("PercentMax (" .. PercentMax .. "%) " .. "Boiler On value (" .. BoilerOnPercent .. "%) " .. "Boiler Off value (" .. (BoilerOnPercent - HysterysisOffPercent) .. ")% ")
print ("Number of valves open more than " .. BoilerOnPercent .. "% is " .. ValveCount .." valves. Minimum valves setting " .. MinValves )
print ("Maximum open value " .. PercentMax .. "%" .. " Override value " .. ValvePercentOveride .."%")
print (" ")
end
if (otherdevices[HolidaySwitch] == 'Off')then -- Not on holiday
if (otherdevices[HeatingSwitch] == 'On')then -- It's time to heat the house
if (otherdevices[BoilerSwitch] == 'Off') then --If a minimum of 'MinValves' valves are on by more that pre-set value BoilerOnPercent
if printDebug == true then
print ("Test passed - Boiler is OFF ")
end
if (PercentMax > BoilerOnPercent) then
if printDebug == true then
print ("Test passed - Radiators are open beyond the threshold ")
end
if (ValveCount >= MinValves) or (BoilerOnPercent >= ValvePercentOveride) then
if printDebug == true then
print ("Test passed - Either multiple valves are open or override count is reached ")
end
commandArray[BoilerSwitch]='On' -- turn on boiler
if printData == true then
print ("Command sent - Turn ON Boiler ")
end
end
end
end
end
if (PercentMax < (BoilerOnPercent - HysterysisOffPercent) or (ValveCount < MinValves)) and (otherdevices[BoilerSwitch] == 'On') then -- If the number of valves open more than BoilerOnPercent minus HysterysisOffPercent
commandArray[BoilerSwitch]='Off' -- turn off boiler
if printData == true then
print ("Command sent - Turn OFF Boiler ")
end
end
else -- on holiday
if (TempMin <= HolidayMinTemp) and (otherdevices[BoilerSwitch] == 'Off') then -- house is very cold
commandArray[BoilerSwitch]='On' -- turn on boiler
end
if (TempMin >= (HolidayMinTemp + HolidayHysterysisTemp)) and (otherdevices[BoilerSwitch] == 'On') then -- house is warm enough
commandArray[BoilerSwitch]='Off' -- turn on boiler
end
end
if printData == true then
print (" ")
end
return commandArray
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
Hi Dave, many thanks for the input!daveabbott007 wrote:NOTE: i am running the script via the Events LUA (Time) page not in a file in the LUA folder (not sure if it makes a difference).
The 2 problems i noticed were,
1. around line 26- TempMin = 100, should be TempMin = 10 (or whatever you want for your lowest temp?)
2. loads of instances of hard coded device names instead of variable name I.E. 'BoilerSwitch' instead of BoilerSwitch,
You are spot on with the variables, that was my error
It also works in the domoticz/scripts/lua folder for me too though... very odd.
Can't think why the max script isn't updating your sensors. I had a new thermostat and valve arrive on Saturday and adding them into my existing set-up was soooo easy. I have 5 rooms covered now and will keep adding one room a month until the wife says "STOP!"
What have you named your devices in the max app and in domoticz?
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
-
daveabbott007
- Posts: 7
- Joined: Friday 03 June 2016 16:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: ELV Max! Heating control system
Hi Sean, i am so glad to have been of some assistance, i ave been taking code from this forum for so long and it feels nice to have finally given something back.blackdog65 wrote:Hi Dave, many thanks for the input!daveabbott007 wrote:NOTE: i am running the script via the Events LUA (Time) page not in a file in the LUA folder (not sure if it makes a difference).
The 2 problems i noticed were,
1. around line 26- TempMin = 100, should be TempMin = 10 (or whatever you want for your lowest temp?)
2. loads of instances of hard coded device names instead of variable name I.E. 'BoilerSwitch' instead of BoilerSwitch,
You are spot on with the variables, that was my errorI'm totally pants with code. I've used your cleaned up version and it works... though bizarrely my version was working for me too
![]()
It also works in the domoticz/scripts/lua folder for me too though... very odd.
Can't think why the max script isn't updating your sensors. I had a new thermostat and valve arrive on Saturday and adding them into my existing set-up was soooo easy. I have 5 rooms covered now and will keep adding one room a month until the wife says "STOP!"![]()
What have you named your devices in the max app and in domoticz?
Sean
Here is my device list from domoticz and max_test.lua, i cant spot any difference in the names (but i have been going name-blind lately)
Domoticz device screen
Code: Select all
214 EQ3 14126 1 RachaelsBedroom-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
206 EQ3 82206 1 RachaelsBedroom-Rad General Percentage 38.00% - - 07/11/2016 12:00
200 EQ3 14118 1 RachaelsBedroom Temp LaCrosse TX3 0.0 C - - 01/11/2016 23:10
211 EQ3 14123 1 MasterBedroom-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
208 EQ3 82208 1 MasterBedroom-Rad General Percentage 22.00% - - 07/11/2016 12:00
201 EQ3 14119 1 MasterBedroom Temp LaCrosse TX3 0.0 C - - 01/11/2016 23:10
216 EQ3 14128 1 LivingRoom2-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
204 EQ3 82204 1 LivingRoom2-Rad General Percentage 29.00% - - 07/11/2016 12:00
215 EQ3 14127 1 LivingRoom1-Stat Thermostat SetPoint 19 - - 07/11/2016 12:13
203 EQ3 82203 1 LivingRoom1-Rad General Percentage 27.00% - - 07/11/2016 12:00
196 EQ3 14114 1 LivingRoom Temp LaCrosse TX3 22.2 C - - 06/11/2016 00:15
218 EQ3 0001412A 1 Holiday Light/Switch Switch Off - - 06/11/2016 21:45
221 EQ3 0 1 HeatingControl Light/Switch Selector Level: 10 % - -07/11/2016 12:07
217 EQ3 14129 1 Heating Light/Switch Switch On - - 06/11/2016 18:25
210 EQ3 14122 1 DinningRoom-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
205 EQ3 82205 1 DinningRoom-Rad General Percentage 21.00% - - 07/11/2016 12:00
197 EQ3 14115 1 DinningRoom Temp LaCrosse TX3 0.0 C - - 01/11/2016 23:10
213 EQ3 14125 1 ConnorsRoom-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
209 EQ3 82209 1 ConnorsRoom-Rad General Percentage 23.00% - - 07/11/2016 12:00
198 EQ3 14116 1 ConnorsRoom Temp LaCrosse TX3 0.0 C - - 01/11/2016 23:10
219 EQ3 0001412B 1 CH_Switch Light/Switch Switch On - - 07/11/2016 12:10
212 EQ3 14124 1 Bathroom-Stat Thermostat SetPoint 19 - - 07/11/2016 12:12
207 EQ3 82207 1 Bathroom-Rad General Percentage 56.00% - - 07/11/2016 12:00
199 EQ3 14117 1 Bathroom Temp LaCrosse TX3 0.0 C - - 01/11/2016 23:10
Code: Select all
pi@domoticz:~$ lua maxtest.lua
Rooms
-----
Bathroom 15D01D
ConnorsRoom 12E51A
DinningRoom 12E6DB
MasterBedroom 138296
LivingRoom 1386FD
RachaelsBedroom 13837F
Devices
-------
Bathroom-Rad 15D01D
ConnorsRoom-Rad 12E51A
DinningRoom-Rad 12E6DB
LivingRoom2-Rad 138766
MasterBedroom-Rad 138296
LivingRoom1-Rad 1386FD
RachaelsBedroom-Rad 13837F
Device status
-------------
Valve LivingRoom2-Rad Setpoint=20 Temp=19.2 Valve pos=29 Battery=OK Mode=Manual
Valve LivingRoom1-Rad Setpoint=20 Temp=21.6 Valve pos=20 Battery=OK Mode=Manual
Valve DinningRoom-Rad Setpoint=20 Temp=20 Valve pos=21 Battery=OK Mode=Manual
Valve MasterBedroom-Rad Setpoint=20 Temp=20.6 Valve pos=22 Battery=OK Mode=Manual
Valve RachaelsBedroom-Rad Setpoint=20 Temp=19.3 Valve pos=38 Battery=OK Mode=Manual
Valve ConnorsRoom-Rad Setpoint=20 Temp=20.4 Valve pos=23 Battery=OK Mode=Manual
Valve Bathroom-Rad Setpoint=20 Temp=19.1 Valve pos=56 Battery=OK Mode=Manual
Code: Select all
2016-11-07 12:50:00.728 LUA: Valve LivingRoom2-Rad Setpoint=18 Temp=22.3 Valve pos=0
2016-11-07 12:50:00.728 LUA: Domoticz setpoint LivingRoom2-Stat updated
2016-11-07 12:50:00.729 LUA: Valve LivingRoom1-Rad Setpoint=18 Temp=23.2 Valve pos=0
2016-11-07 12:50:00.729 LUA: Domoticz setpoint LivingRoom1-Stat updated
2016-11-07 12:50:00.729 LUA: Valve DinningRoom-Rad Setpoint=18 Temp=23 Valve pos=0
2016-11-07 12:50:00.729 LUA: Domoticz setpoint DinningRoom-Stat updated
2016-11-07 12:50:00.729 LUA: Valve MasterBedroom-Rad Setpoint=18 Temp=22.3 Valve pos=0
2016-11-07 12:50:00.729 LUA: Domoticz setpoint MasterBedroom-Stat updated
2016-11-07 12:50:00.730 LUA: Valve RachaelsBedroom-Rad Setpoint=18 Temp=20.7 Valve pos=0
2016-11-07 12:50:00.730 LUA: Domoticz setpoint RachaelsBedroom-Stat updated
2016-11-07 12:50:00.730 LUA: Valve ConnorsRoom-Rad Setpoint=18 Temp=22.3 Valve pos=0
2016-11-07 12:50:00.730 LUA: Domoticz setpoint ConnorsRoom-Stat updated
2016-11-07 12:50:00.730 LUA: Valve Bathroom-Rad Setpoint=18 Temp=22.5 Valve pos=0
2016-11-07 12:50:00.730 LUA: Domoticz setpoint Bathroom-Stat updated
2016-11-07 12:50:00.732 EventSystem: Fetching url...
2016-11-07 12:50:00.732 EventSystem: Fetching url...
2016-11-07 12:50:00.733 EventSystem: Fetching url...
2016-11-07 12:50:00.734 EventSystem: Fetching url...
2016-11-07 12:50:00.734 EventSystem: Fetching url...
2016-11-07 12:50:00.735 EventSystem: Fetching url...
2016-11-07 12:50:00.736 EventSystem: Fetching url...
2016-11-07 12:50:00.736 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_time_max.lua
i cant see whats up with names, Temps will not update in Domoticz, Setpoints will not update in Domticz from Max But max will change if i change Domoticz setpoints.
Any help or ideas greatfully recived
Dave
-
Skippiemanz
- Posts: 230
- Joined: Sunday 14 July 2013 20:21
- Target OS: Linux
- Domoticz version: 4.10233
- Location: Alkmaar, The Netherlands
- Contact:
Re: ELV Max! Heating control system
Dave,
Thanks for your update on the code! I will change it to your version in the WiKi!
Do you log out of the max application? Also completly close the java app from the task bar? Maybe that has something to do with it? Your name scheme seems correct!
Thanks for your update on the code! I will change it to your version in the WiKi!
Do you log out of the max application? Also completly close the java app from the task bar? Maybe that has something to do with it? Your name scheme seems correct!
- blackdog65
- Posts: 311
- Joined: Tuesday 17 June 2014 18:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Norfolk, UK
- Contact:
Re: ELV Max! Heating control system
Thanks Skippiemanz, saved me a jobSkippiemanz wrote:Dave,
Thanks for your update on the code! I will change it to your version in the WiKi!
Do you log out of the max application? Also completly close the java app from the task bar? Maybe that has something to do with it? Your name scheme seems correct!
@Dave, it looks to me that the max_test.lua and threfore script_time_max.lua is only reading your radiator valves and not seeing the wall stats... though where it gets the "LivingRoom" temp from is a mystery.
Code: Select all
local useWMT = true --Set to true if there is a wall mounted thermostat in every roomI hope this help... and Skippiemanz may be right about logging out of the MAX app.
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Who is online
Users browsing this forum: No registered users and 1 guest