ELV Max! Heating control system

For heating/cooling related questions in Domoticz

Moderator: leecollings

badubo
Posts: 4
Joined: Thursday 03 July 2014 20:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by badubo »

Hi,

I followed the instructions (thanks for the tutorial) and everything is working.
I have only one problem :
The system works without any issues during a couple of days (can be 1 week) but, after some time, the values of all devices are frozen and the system returns the same values until I restart the script.
What is strange is that in the logs I don't see any error. It simply continues to work "in a normal way" but all values do not involve any more.

Has anyone the same issue?

Thanks
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

Hi Guys,
I couldn't wait to the end of the heating season, I was weak and purchased a cube plus a handful of Rad valves and thermostats.
First impression, the EQ3 interface and portal are limited to say the least, poor implementation in my view.
Hey-ho, not a lot I can do about that.

So, installed Max-Buddy onto a Windows system (also hosts my Domoticz) without too much issue.
The Max-Buddy forum has gone 502-Bad Gateway, so was winging it.

Added maxtrash's script (many thanks dude!), and enabled it - pow, a pile of new devices in Domoticz.
Little issue, I hadn't changed the HID (hardware ID) and they appeared as local weather station devices... doh!
Created a new dummy device, called it EQ3 Max! and changed the script HID to match the new hardware device and tried again.
Whoo, lots of new EQ3 devices in unused devices.

Spent a bit of time configuring the EQ-3 system to suit the environment and then returned to Domoticz.

I've not yet interlocked the systems, they both run separately.
However I will be adding a switch that will sit in parallel with the thermostat / timer to over ride it.
I've written some code that I will be keeping an eye on before I actually allow it to do anything.

Code: Select all


-- script_time_Heating Valves.lua
-- Script to read the % open of radiator valves
-- All radiator valves are labelled "RV <room name>" 
-- search is made for  "RV " (Note space) to indicate a radiator valves
-- If found it will be interrogated for % open 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
HysterysisOffPercent = 10
PercentMax = 0

-- Set printing to log options (true / false)
printData = false
-- printData = true


commandArray = {}
 
 -- Get Data
for i, v in pairs(otherdevices) do -- Get all devices in the database
   v = i:sub(1,3) -- Grab the first three characters of the device name
   
   if (v == 'RV ') then -- are the first three characters "RV "? If so we have a Radiator Valve
   
         RoomName = i:sub(4) -- Get the rest of the name, which will be the room name
		 sValvePercentOpen, sDummy = otherdevices_svalues[i]:match("([^;]+);([^;]+)") -- get the % open (temperature) and humidity (unused, always '0')
		 
         message = RoomName.." valve is open " .. sValvePercentOpen .. " percent "  -- for debug
         if printData == true then
			print(message)
		 end
		 
		 -- get the % value of the most open Radiator Valve
		 if tonumber(sValvePercentOpen) > PercentMax then
			PercentMax = tonumber(sValvePercentOpen)
		 end
		 
   end

end
 
  if printData == true then
 print("Highest valve open value is " .. PercentMax .." percent ")
 end
 
-- Perform logic 
   if PercentMax > BoilerOnPercent and (otherdevices['Boiler On (B1)'] == 'Off')then --If any valve is on by more that pre-set value BoilerOnPercent
		commandArray['Boiler On (B1)']='On' -- turn on boiler
	end
    
	if PercentMax < (BoilerOnPercent - HysterysisOffPercent) and (otherdevices['Boiler On (B1)'] == 'On')then -- If all valves are closed more than BoilerOnPercent minus HysterysisOffPercent
   		commandArray['Boiler On (B1)']='Off' -- turn off boiler
	end

	
 
return commandArray

Note, the above code assumes that all radiator valves are labelled as RV <room name> as it checks for the "RV " string to locate all valves.
There is a lot of debug printing at the moment, switched with a label at the beginning.

I have got it operating a dummy switch called 'Boiler On (B1)' at the moment.
This will allow me to check it's logs and see how it is performing.
Once I'm happy I'll be using a real switch to control the boiler.

Question, I have Thermostats (temperature) and Radiator Valves (Temperature, Humidity. Which relate to percentage open, zero).
I'm left with another radiator object that seems to show either a real temperature or possibly a set point (don't think so but..)?
They do not have an identifiable serial number to tie it in with.
I know they are radiator objects as the numbers correspond.
Any clues?

I'll report back with any updates.

Kevin
Non credus crepitus
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

Post by Skippiemanz »

Kevin,

thanks for your effort.

The other device/temperature is the actual temp.

the other one is indeed the set point temperature and the percentage of the valve.

Im testing your script now.

Looks promissing.
sj3fk3
Posts: 23
Joined: Sunday 22 March 2015 6:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by sj3fk3 »

I think i've setup everything according the little how-to here, but it looks like I'm not requesting any API url's on the domoticz host I don't get new hardware and I don't see the debug lines in the console...

[2015-03-23 19:06:20,615] [DEBUG]: updateWallThermostatTemperatures()
[2015-03-23 19:06:23,827] [DEBUG]: executeScript(Domoticz.js)
[2015-03-23 19:06:23,832] [DEBUG]: [Domoticz.js]: Start RUN routine
[2015-03-23 19:06:23,836] [DEBUG]: [Domoticz.js]: Start run()
[2015-03-23 19:06:23,840] [DEBUG]: [Domoticz.js]: Room = Anouk
[2015-03-23 19:06:23,842] [DEBUG]: [Domoticz.js]: Mode = AUTO
[2015-03-23 19:06:23,844] [DEBUG]: [Domoticz.js]: Param = [Ljava.lang.String;@ec7f33
[2015-03-23 19:06:23,846] [DEBUG]: [Domoticz.js]: Device = RT Anouk
[2015-03-23 19:06:23,848] [DEBUG]: [Domoticz.js]: SerialNumber = IEQ0501176
[2015-03-23 19:06:23,850] [DEBUG]: [Domoticz.js]:
[2015-03-23 19:06:23,853] [DEBUG]: [Domoticz.js]: Room = badkamer
[2015-03-23 19:06:23,855] [DEBUG]: [Domoticz.js]: Mode = AUTO
[2015-03-23 19:06:23,857] [DEBUG]: [Domoticz.js]: Param = [Ljava.lang.String;@2b941e
[2015-03-23 19:06:23,860] [DEBUG]: [Domoticz.js]: Device = RT badkamer
[2015-03-23 19:06:23,862] [DEBUG]: [Domoticz.js]: SerialNumber = IEQ0508347
[2015-03-23 19:06:23,863] [DEBUG]: [Domoticz.js]:
[2015-03-23 19:06:23,867] [DEBUG]: [Domoticz.js]: Room = Zolder
[2015-03-23 19:06:23,869] [DEBUG]: [Domoticz.js]: Mode = AUTO
[2015-03-23 19:06:23,871] [DEBUG]: [Domoticz.js]: Param = [Ljava.lang.String;@141443
[2015-03-23 19:06:23,873] [DEBUG]: [Domoticz.js]: Device = RT Zolder
[2015-03-23 19:06:23,875] [DEBUG]: [Domoticz.js]: SerialNumber = IEQ0508372
[2015-03-23 19:06:23,877] [DEBUG]: [Domoticz.js]:
[2015-03-23 19:06:23,880] [DEBUG]: [Domoticz.js]: Room = Baby kamer
[2015-03-23 19:06:23,882] [DEBUG]: [Domoticz.js]: Mode = AUTO
[2015-03-23 19:06:23,884] [DEBUG]: [Domoticz.js]: Param = [Ljava.lang.String;@1169e25
[2015-03-23 19:06:23,887] [DEBUG]: [Domoticz.js]: Device = RT Babykamer
[2015-03-23 19:06:23,889] [DEBUG]: [Domoticz.js]: SerialNumber = IEN0046356
[2015-03-23 19:06:23,890] [DEBUG]: [Domoticz.js]:
[2015-03-23 19:06:23,894] [DEBUG]: [Domoticz.js]: Room = Kantoor
[2015-03-23 19:06:23,896] [DEBUG]: [Domoticz.js]: Mode = MANUAL
[2015-03-23 19:06:23,898] [DEBUG]: [Domoticz.js]: Param = [Ljava.lang.String;@ca6053
[2015-03-23 19:06:23,900] [DEBUG]: [Domoticz.js]: Device = RT Kantoor
[2015-03-23 19:06:23,902] [DEBUG]: [Domoticz.js]: SerialNumber = IEN0045744
[2015-03-23 19:06:23,904] [DEBUG]: [Domoticz.js]:
[2015-03-23 19:06:23,931] [DEBUG]: Script execution time: 100ms
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

Hi Skippiemanz,

Good to know about those other values.
I've left them unused for the time being, I'll add them if I need to use them later. - Thanks

the script has moved on somewhat as I've been playing with it.
I had added some logic which seemed to break it, so I've added a lot more print to log lines to fathom out what has been happening.
It seems to be working OK as far as day to day operations, but it is very messy! :)

I've also added some extra checks for a 'Holiday switch I have set up which manages my lights while I am away from home.
It should suppress the temperatures to prevent the boiler firing until the house gets too cold.
(not tested this yet, just added the code as a place holder.)

I've added a minimum number of valves calling to heat value to suppress the boiler until there is a real demand for heat.
But with an override if a single valve is fully open.

I also read in the thermostat values and do some work with them.
All my thermostats are in the form of "Stat <room name>"

The code is below, but it is currently full of print statements and is becoming specific to my set up, what with the holiday switch.
I will tidy it up once I get the confidence it is ok.

Code: Select all

-- script_time_Heating Valves.lua
-- Version 1.6 22/03/15
-- Script to read the % open of radiator valves
-- All radiator valves are labelled "RV <room name>" 
-- search is made for  "RV " (Note space) to indicate a radiator valve
-- If found it will be interrogated for % open value

-- Thermostat are named "Stat <room name>" so a search is made for "Sta" 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 = 50			-- 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 = 99		-- 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

-- Script Variables
PercentMax = 0
TempMin = 100
ValveCount = 0

-- Set printing to log options (true / false)
-- printData = false
printData = true
-- printDebug = false
printDebug = true


commandArray = {}
 
		 -- print blank line in log 
		 if printData == true then
			print (" ")
			print (" *** Heating Script Output ***")
			print (" ")
		 end
		 
		 -- Get Data
		for i, v in pairs(otherdevices) do -- Get all devices in the database
		   v = i:sub(1,3) -- Grab the first three characters of the device name
		   
			   if (v == 'RV ') then -- are the first three characters "RV "? If so we have a Radiator Valve
			   
					 RoomName = i:sub(4) -- Get the rest of the name, which will be the room name
					 sValvePercentOpen, sDummy = otherdevices_svalues[i]:match("([^;]+);([^;]+)") -- get the % open (temperature) and humidity (unused, always '0')
					 
					 message = RoomName.." valve is open " .. sValvePercentOpen .. " percent "  -- for debug
					 if printData == true then
						print(message)
					 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		
		
		for i, v in pairs(otherdevices) do -- Get all devices in the database
		   v = i:sub(1,3) -- Grab the first three characters of the device name
			   
			   if (v == 'Sta') then -- are the first three characters "Sta"? If so we have an EQ-3 Thermostat
			   
					 RoomName = i:sub(6) -- Get the rest of the name, which will be the room name
  					 sTemp = otherdevices_svalues[i] -- get the temperature					
					 message = RoomName.." temperature is " .. sTemp .. " Centigrade "  -- for debug
					 if printData == true then
						print(message)
					 end
					 
					 -- get the lowest temperature of the thermostats
					 if tonumber(sTemp) < TempMin then
						TempMin = tonumber(sTemp)
					 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['Boiler On (B1)'] == 'On')then
			print ("Current state - Boiler is ON ")
		else
			print ("Current state - Boiler is OFF ")
		end	

	end			

		
		-- Perform logic 
		
		if printDebug == true then
			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['On Holiday'] == 'Off')then -- Not on holiday 
		
		   if (otherdevices['Boiler On (B1)'] == '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['Boiler On (B1)']='On' -- turn on boiler
							if printData == true then
								print ("Command sent - Turn ON Boiler ")
							end	
					end
				end
			end
			
			if (PercentMax < (BoilerOnPercent - HysterysisOffPercent) or (ValveCount < MinValves)) and (otherdevices['Boiler On (B1)'] == 'On')  then -- If the number of valves open more than BoilerOnPercent minus HysterysisOffPercent
				commandArray['Boiler On (B1)']='Off' -- turn off boiler
						if printData == true then
							print ("Command sent - Turn OFF Boiler ")
						end	
			end
			
		else -- on holiday
		
			if (TempMin <= HolidayMinTemp) and (otherdevices['Boiler On (B1)'] == 'Off') then  -- house is very cold
				commandArray['Boiler On (B1)']='On' -- turn on boiler
			end
			
			if (TempMin >= (HolidayMinTemp + HolidayHysterysisTemp)) and (otherdevices['Boiler On (B1)'] == 'On') then  -- house is warm enough
				commandArray['Boiler On (B1)']='Off' -- turn on boiler
			end
			
		end
	 if printData == true then
		print (" ")
	 end
		
 
return commandArray

My biggest issue is that I'm getting valves open during the night when the room temperatures should be suppressed.
I'm sure that the data is being read in correctly, the radiator valve logs show some valves open during the night.
This is operating my boiler switch during the night - not desirable
I'm currently suspecting the cube timing periods, they sometimes look disjointed with gaps through the day.
I can tidy them up but they show the gaps again when I return.
It's a real pain at the moment, I may have to reset the cube and start from scratch.

I'll post an updated script once I've tidied it up again.

Kevin
Non credus crepitus
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

Hi sj3fk3,
I'm not using a Pi to run my system but a quick question, have you updated the domoticz.js script to change the Domoticz IP address to the IP address of your system?

Kevin
Non credus crepitus
sj3fk3
Posts: 23
Joined: Sunday 22 March 2015 6:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by sj3fk3 »

l0gic wrote:Hi sj3fk3,
I'm not using a Pi to run my system but a quick question, have you updated the domoticz.js script to change the Domoticz IP address to the IP address of your system?
Kevin
Yeah :) If I tcpdump I don't see any traffic either.
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

sj3fk3 wrote: Yeah :) If I tcpdump I don't see any traffic either.
Have you enabled the script to be run by Max Buddy?

Datei -> Einstelllungen -> Skripte -> Select 'domoticz'

If that is ticked then I'm at a loss I'm afraid.

Kevin
Non credus crepitus
sj3fk3
Posts: 23
Joined: Sunday 22 March 2015 6:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by sj3fk3 »

yup, as you can see from the log it's running, just no URL calls.. hmm :/
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

sj3fk3 wrote:yup, as you can see from the log it's running, just no URL calls.. hmm :/
Weird!

Only other thing I can think of is a firewall blocking it leaving the Pi.
Non credus crepitus
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

Post by Skippiemanz »

Logic,

In my log prints i see the tempature set is beeing used as percentages. I think this is wrong. Is this just in my case or?
I see in your script that your ignoring the humidty part but this is actually the valve open or close percentage!

When we add the RV thermostats we get 2 devices.

Device 1(Rubicson/IW008T/TX95) shows the set temperature in degrees and the percentage of the valve open or close(Humidity)
Device 2(RUBiCSON) shows the real room temperature!

And how did you set up the dummy switch? I've created on called Boiler On but it wont be switched on in my case?!

Or are you using any user variables? Please explain so i can test for yuo and give feedback

I will now try your second script
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

ELV Max! Heating control system

Post by l0gic »

Hi Skippiemanz,

looking at it I think you are correct.
The code I'm using to separate out the temperatures I re-used from my Oregon Temp / Humidity units.
They were in the form of T;H
The valves (Rubicson/IW008T/TX95) are in the form of x, ;y;z so I'm only pulling out x, & y
For me x is always 0 and z is always 0. I've never noticed a different value for either of them.
y corresponds with the percent open of the valve.

The valves (RUBiCSON) I've not used yet but to be honest have never looked at them so far.
But they do look very 'actual' temperature rather than set temperatures

Here is a snapshot of my (Rubicson/IW008T/TX95) valves

Code: Select all

122	EQ-3 Max! Heating Controls	1159545	2	RV Kitchen	Temp + Humidity	Rubicson/IW008T/TX95	0, ;89;0
121	EQ-3 Max! Heating Controls	1160566	2	RV Main Bedroom	Temp + Humidity	Rubicson/IW008T/TX95	0, ;0;0	
120	EQ-3 Max! Heating Controls	1160521	2	RV Dining Room	Temp + Humidity	Rubicson/IW008T/TX95	0, ;89;0
119	EQ-3 Max! Heating Controls	1160512	2	RV Front Room 2	Temp + Humidity	Rubicson/IW008T/TX95	0, ;100;0
118	EQ-3 Max! Heating Controls	1160513	2	RV Front Room 1	Temp + Humidity	Rubicson/IW008T/TX95	0, ;100;0
111	EQ-3 Max! Heating Controls	1160762	2	RV En-Suite	Temp + Humidity	Rubicson/IW008T/TX95	0, ;0;0	
106	EQ-3 Max! Heating Controls	1160507	2	RV Conservatory	Temp + Humidity	Rubicson/IW008T/TX95	0, ;53;0
How do they compare with yours?

I'll write a new script tonight to just pull out all the values, check we are in a good place and then get back to the main task of having a good heating script.

To create my dummy switch I just went to the switch page, clicked 'Manual Light / Switch', named it, left the type as X10 and just randomly selected a code (assuming you are not using any X10 in your system)

I'm not using any user variables.

I'll be back with some code later :)
Non credus crepitus
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

Post by Skippiemanz »

where did you extract that neat list?

So we can compare. i assume it will be Set point, Actual Temp, Valve percentage

Let me know. We will get there haha.. Maybe we could also use some of the smartware RV functions?

//types for Radiator valve
#define pTypeRadiator1 0x48
#define sTypeSmartwares 0x0 //Homewizard smartwares

#define Radiator1_sNight 0x0
#define Radiator1_sDay 0x1
#define Radiator1_sSetTemp 0x2
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

Go into Setup -> Devices then search (if required) on Rubicson/IW008T/TX95
then do a cut 'n paste.

I've had a play with the Rubicson devices.
I'm no clearer what they represent.
As they show decimal points i.e. 19.2 I assumed they could be real time temperatures.
However, I've sat with a hair dryer on one of them and the values haven't moved....
I'll dig further when I have the time.

I'm having issues with the match function at the moment, soon once I've beaten it I'll post up again.
Non credus crepitus
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

Post by Skippiemanz »

Ah ok.. Thought so!

Code: Select all

71	Dummy	825311	2	RV Zolder-Links	Temp + Humidity	Rubicson/IW008T/TX95	17.0 C, 0 %	12	
  	85	Dummy	439915	2	RV Zolder-Rechts	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 100 %	12
  	88	Dummy	825298	2	RV Hal	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 75 %	12
  	90	Dummy	825382	2	RV Kamer-Links	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 100 %	12
  	77	Dummy	825411	2	RV Tijn	Temp + Humidity	Rubicson/IW008T/TX95	18.0 C, 90 %	12
  	80	Dummy	825036	2	RV Noa	Temp + Humidity	Rubicson/IW008T/TX95	18.0 C, 6 %	12
  	83	Dummy	439956	2	RV Badkamer	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 100 %	12
  	97	Dummy	825410	2	RV Kantoor	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 73 %	12
  	92	Dummy	824942	2	RV Kamer-Rechts	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 100 %	12
What ive read somewhere is that the real temperature is only updated when the valve position is changed or the set point is altered!

Looking forward to your progres
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

I also read somewhere that temperature is only updated on change, so I tried rotating the valve control to change the set point.
I still didn't see any change :)

Hmmm, I notice that your Rubicson/IW008T/TX95 strings have values that are different to mine .....

RV Zolder-Links Temp + Humidity Rubicson/IW008T/TX95 17.0 C, 0 % - yours
RV Kitchen Temp + Humidity Rubicson/IW008T/TX95 0, ;89;0 - mine

That is somewhat confusing.
Is there more than one version of domoticz.js I wonder?
Yours seems to carry a richer feature set and probably will not work with my code as it would parse different giving different values.

I think this needs to be sorted before we sort any code out.

Can you post up your version of domoticz.js please, it looks like it produces a better output.

Cheers

Kevin
Non credus crepitus
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

Post by Skippiemanz »

Kevin,

tinman made a small change in the past to the Domoticz.js(dont know if it has anything to do with it)

Code: Select all

SetPointTemperature = SetPointTemperature.substring(0, SetPointTemperature.indexOf('º')).replace(',','.');

becomes

SetPointTemperature = SetPointTemperature.substring(0, SetPointTemperature.indexOf(',')+2).replace(',','.');
And here is my compleet code:

Code: Select all

/*
    Domoticz.js
    2013-11-03

   script for Max!Buddy
   How to install: put it in the script-folder and enable the script in the Max!Buddy settings
   
   Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

*/

function getInfo(info) {
   info.name = 'Domoticz';
   info.description = 'Connector for Domoticz';
   info.interval = 30;
}
function run() {

   var toString = function(text) {
      return text + '';
   };

   var h2d = function(h) {
      return parseInt(h,16);
   };

   var   HID = '8',                                  //Hardware ID of dummy in Domoticz
      IP = '192.168.165.10',                         //IP address of Domoticz 
      Port = '9090',                              //Port of Domoticz
      
      // for types please refer to http://sourceforge.net/p/domoticz/code/HEAD/tree/domoticz/main/RFXtrx.h
      // for Maxbuddy API please refer to http://bugs.maxbuddy.de/projects/maxbuddy/wiki/Buddy_API
      WMT_dtype1 = '80', WMT_subtype1 = '9',             //WallMountedThermostat Domoticz types for current temperature (temperature , RUBiCSON)
      HT_dtype1 = h2d('0x50'), HT_subtype1 = '9',             //HeatingThermostat Domoticz types for current temperature (temperature , RUBiCSON)
      HT_dtype2 = h2d('0x52'), HT_subtype2 = h2d('0xA'),          //HeatingThermostat Domoticz types for current temperature (temperature , RUBiCSON)
      SC_dtype1 = h2d('0x20'), SC_subtype1 = '01',               //ShutterContact 
      einde;
      
   var startTime = new Date().getTime(),
      URL = java.net.URL,
      IOUtils = org.apache.commons.io.IOUtils,
      DataOutputStream = java.io.DataOutputStream,
      JSON = {},
      roomIDs = buddy.getRoomIDs(),
      SerialNumber, DomoticzDid, Temperature, SetPointTemperature, Valve, WindowOpen;

   var OpenUrl = function(did, dunit, dtype, dsubtype, nvalue, svalue, response) {
      
      var URLString;
      
      URLString = 'http://'+IP+':'+Port+ '/json.htm?type=command&param=udevice&hid='+HID+'&did='+did+'&dunit='+dunit+'&dsubtype='+dsubtype+
                     '&dtype='+dtype+'&nvalue='+nvalue+'&svalue='+svalue;
      debug( '   '+URLString);
      
      var url = new URL(   URLString),
         outputStream,
         out;

      connection = url.openConnection();
      
      connection.setRequestMethod('POST');
      connection.setReadTimeout(5000);
      connection.setDoOutput(true);
      connection.setRequestProperty('Content-type', 'application/json');

      try {
         outputStream = connection.getOutputStream();
         out = new DataOutputStream(outputStream);
         out.writeBytes(response);
         out.flush();
         out.close();
         connection.connect();
         connection.getInputStream();
      }
      catch(err) {
         debug(new Error('Could not connect to server: '));
         debug(err);
      }
   };

   debug('Start run()');
            
   for(var i=0; i < roomIDs.length; i++) {
      var room = buddy.getRoom(roomIDs[i]),
         mode = buddy.getRoomMode(roomIDs[i]),
         _devices = room.getDevices(),
         devices = [];
      debug('Room  = '+room.getName());
      debug('Mode  = '+mode.getMode());
      //debug('Param = '+mode.getParameters());
      
      
      for(var j=0; j < _devices.size(); j++) {
         var device = _devices.get(j),
            state = device.getState();
         
         debug('   Device = '+device.getName());
         SerialNumber = device.getSerialNumber();
         debug('   SerialNumber = '+SerialNumber);
         debug('');

         if(device.getDeviceType() == 'WallMountedThermostat') {
            DomoticzDid = toString(h2d(SerialNumber.substring(3)));          
            Temperature = toString(state.getTemperature());
            debug('   Temperature = '+Temperature);
            OpenUrl(DomoticzDid, '1', WMT_dtype1, WMT_subtype1, '0',Temperature);
            debug('');
         }

         if(device.getDeviceType() == 'HeatingThermostat') {
            // chop off first 3 characters (e.g. JEQ or KEQ). Then convert to decimal because domoticz will do dec to hex conversion
            // this way the ID in domoticz is the same as the SerialNumber            
            DomoticzDid = toString(h2d(SerialNumber.substring(3)));
            
            Temperature = toString(state.getMeasuredTemperature());
            debug('   Temperature = '+Temperature);
            SetPointTemperature = toString(state.getSetPointTemperature());
SetPointTemperature = SetPointTemperature.substring(0, SetPointTemperature.indexOf(',')+2).replace(',','.');
            debug('   SetPointTmp = '+SetPointTemperature);
            Valve = toString(state.getValvePosition());
            debug('   Valve       = '+Valve);
            OpenUrl(DomoticzDid, '1', HT_dtype1, HT_subtype1, '0', Temperature);
            OpenUrl(DomoticzDid, '2', HT_dtype2, HT_subtype2, '0', SetPointTemperature+';'+Valve+';0');  // HumidityStatus = 0 ???
            debug('');
         }
         if(device.getDeviceType() == 'ShutterContact') {
            DomoticzDid = toString(SerialNumber.substring(3)); 
            if (state.isWindowOpen() == true) {
               WindowOpen = 2;
            }
            else {
               WindowOpen = 0;
            }
            debug('   Window open = '+ WindowOpen);
            OpenUrl(DomoticzDid, '1', SC_dtype1, SC_subtype1, WindowOpen, '');
         }
      }
   }
}
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: ELV Max! Heating control system

Post by l0gic »

Great stuff!

I now have an output from my Rubicson/IW008T/TX95 in the form Set point, Valve open percent (humidity)

I hadn't realised there had been a change in the code - good spot.

We now have similar readings we can work from.

Code: Select all


  	111	EQ-3 Max! Heating Controls	1160762	2	RV En-Suite	Temp + Humidity	Rubicson/IW008T/TX95	21.0 C, 28 %
  	121	EQ-3 Max! Heating Controls	1160566	2	RV Main Bedroom	Temp + Humidity	Rubicson/IW008T/TX95	19.0 C, 72 %
  	122	EQ-3 Max! Heating Controls	1159545	2	RV Kitchen	Temp + Humidity	Rubicson/IW008T/TX95	20.0 C, 100 %	
  	106	EQ-3 Max! Heating Controls	1160507	2	RV Conservatory	Temp + Humidity	Rubicson/IW008T/TX95	18.5 C, 29 %	
  	118	EQ-3 Max! Heating Controls	1160513	2	RV Front Room 1	Temp + Humidity	Rubicson/IW008T/TX95	18.5 C, 100 %
  	119	EQ-3 Max! Heating Controls	1160512	2	RV Front Room 2	Temp + Humidity	Rubicson/IW008T/TX95	18.5 C, 100 %
  	120	EQ-3 Max! Heating Controls	1160521	2	RV Dining Room	Temp + Humidity	Rubicson/IW008T/TX95	19.0 C, 0 %

Right, I'll get cracking on the heating script again now.
With a bit of luck it may work for both of us... :)

I'll report back later.

Kevin
Non credus crepitus
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

Post by Skippiemanz »

Great,

fingers crossed... Looks promissing so keep up the good work!
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

ELV Max! Heating control system

Post by l0gic »

Hi Skippiemanz,

I've had a little play with the script.
It should be working as intended (not checked the holiday part)

You may want to change the preset values as I've been pushing them around while testing.

Code: Select all


-- script_time_Heating Valves.lua
-- Version 1.7 25/03/15
-- Script to read the % open of radiator valves
-- All radiator valves are labelled "RV <room name>" 
-- search is made for  "RV " (Note space) to indicate a radiator valve
-- If found it will be interrogated for % open value

-- Thermostat are named "Stat <room name>" 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 = 50			-- 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 = 99		-- 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

-- Script Variables
PercentMax = 0
TempMin = 100
ValveCount = 0

-- Set printing to log options (true / false)
-- printData = false
printData = true
printDebug = false
-- printDebug = true




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(1,3) -- Grab the first three characters of the device name
		   
			   if (v == 'RV ') then -- are the first three characters "RV "? If so we have a Radiator Valve
			   
					 RoomName = i:sub(4) -- Get the rest of the name, which will be the room name
					 sSetTempValue, sValvePercentOpen = otherdevices_svalues[i]:match("([^;]+);([^;]+)") -- get the valve set Point and the  valve % open (Temp, Humidity)
					 
					 message = RoomName.." valve is open " .. sValvePercentOpen .. " percent " .. " Setpoint temperature is " .. sSetTempValue .. "C"-- for debug
					 if printData == true then
						print(message)
					 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(1,5) -- Grab the first three characters of the device name
			   
			   if (v == 'Stat ') then -- are the first five characters "Stat "? If so we have an EQ-3 Thermostat
			   
					 RoomName = i:sub(6) -- Get the rest of the name, which will be the room name
  					 sTemp = otherdevices_svalues[i] -- get the temperature					
					 message = RoomName.." temperature is " .. sTemp .. " Centigrade "  -- for debug
					 if printData == true then
						print(message)
					 end
					 
					 -- get the lowest temperature of the thermostats
					 if tonumber(sTemp) < TempMin then
						TempMin = tonumber(sTemp)
					 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['Boiler On (B1)'] == 'On')then
			print ("Current state - Boiler is ON ")
		else
			print ("Current state - Boiler is OFF ")
		end	

	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['On Holiday'] == 'Off')then -- Not on holiday 
		
		   if (otherdevices['Boiler On (B1)'] == '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['Boiler On (B1)']='On' -- turn on boiler
							if printData == true then
								print ("Command sent - Turn ON Boiler ")
							end	
					end
				end
			end
			
			if (PercentMax < (BoilerOnPercent - HysterysisOffPercent) or (ValveCount < MinValves)) and (otherdevices['Boiler On (B1)'] == 'On')  then -- If the number of valves open more than BoilerOnPercent minus HysterysisOffPercent
				commandArray['Boiler On (B1)']='Off' -- turn off boiler
						if printData == true then
							print ("Command sent - Turn OFF Boiler ")
						end	
			end
			
		else -- on holiday
		
			if (TempMin <= HolidayMinTemp) and (otherdevices['Boiler On (B1)'] == 'Off') then  -- house is very cold
				commandArray['Boiler On (B1)']='On' -- turn on boiler
			end
			
			if (TempMin >= (HolidayMinTemp + HolidayHysterysisTemp)) and (otherdevices['Boiler On (B1)'] == 'On') then  -- house is warm enough
				commandArray['Boiler On (B1)']='Off' -- turn on boiler
			end
			
		end
	 if printData == true then
		print (" ")
	 end
		
 
return commandArray

I've got to revisit my cube set up as certain rooms still open my valves trough the night even though the rooms should be going cold overnight.
It is skewing my logs as the boiler switch is on all through the night, which is not ideal...

If you can give the latest script a go while I attack my cube and just feed back any problems.
Non credus crepitus
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests