Page 1 of 37

ELV Max! Heating control system

Posted: Sunday 03 November 2013 18:30
by maxtrash
The ELV Max! Heating control system (also sold by Conrad) is a relatively cheap system consisting of electronic radiator valves, thermostats, window sensors and a cube (to control everything through the network/internet).
Using Max buddy it is possible to extend the possibilities. One of the possibilities of this nice (and free) program is the ability to make use of javascript scripts. I've been playing with a script to connect the system to Domoticz. In the script it is possible to read data from the system using the Max buddy API.

Installation:
- install the Max! system and discover the components with it's regular software
- install maxbuddy and put the script in its script-directory.
- open the script with notepad++ and edit some of the data (most importantly the ip-address of Domoticz.)
- goto maxbuddy settings and enable the script. Check the console to see if there are any errors and to see the id's + names of the components

Personally I've installed Maxbuddy on a windows laptop (for now), but it should be possible to also make it work on a raspberry pi.

If everything works in Domoticz there will be a bunch of new devices in unused devices tab. The ID should resemble the serialnumber of the MAX-components.
for now, the radiator thermostat will end up as a temperature device in Domoticz (current temperature).
the radiator valve will end up as two devices: a temperature device device which will display the current temperature (NB. radiators will only send temperature when valve opening changes and it's not as accurate as the thermostat temperature). The second devices is a temperature+humidity device. The temperature is the setpoint (soll-) temperature, the percentage is the valve-opening percentage.
the door/window sensor is shown as an X10 security device, and status alarm when the window is open.

Image

I hope there are more people with the ELV Max! system. Would be interested in your feedback

@Gizmocuz: I like it a lot that I was able to use the Domoticz-http-post method for integration with Domoticz. Still struggling with the correct devices though and what to put in the URL (when to use nvalue, when to use svalue, number of parameters, how to set battery level etc.).
I also noticed in mainworker.cpp that there are already some FS20 devices like sTypeFHT8V ("subtype = FHT 8V valve") and sTypeFHT80 ("subtype = FHT80 door/window sensor"). Is it possible to somehow use these?

I also think it could be very nice to have a virtual info sensor.
Image
So it would be possible to use something like
http://192.168.1.24:8080/json.htm?type= ... _displayed

anyway, this is the script.

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 = '3', 											//Hardware ID of dummy in Domoticz
		IP = '192.168.1.24', 								//IP address of Domoticz (127.0.0.1 for same machine)
		Port = '8080',										//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('ยบ')).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, '');
			}
		}
	}
}

Re: ELV Max! Heating control system

Posted: Tuesday 12 November 2013 9:02
by mobisat
My MAX! rad valves and cube arrived yesterday. I set them all up last night although one valve was DOA and a second one has a RF problem.

Once I have let it settle in for a few days I may venture into this as well. Currently I have my boiler controlled by an in-line relay in parallel with the boiler timeclock so the timeclock is always switched off now. I have a boiler on/off, boiler 30 minute and boiler 60 minute virtual switches to control the relay. Working well so far.

Re: ELV Max! Heating control system

Posted: Saturday 16 November 2013 10:25
by goedh452
I'm very curious to find out if it is also possible to control the radiator valves via Domoticz. For example opening or closing the valve the same way a dimmer works. We normally do not use the radiators upstairs, but when the kids play in their room it would be nice just for that occasion to open a valve manually.

Re: ELV Max! Heating control system

Posted: Saturday 16 November 2013 11:40
by maxtrash
Of course that can be done with the elv max software.
It doesn't work with sliders though but can you can set a setpoint temperature.
Unfortunately there is no thermostat device yet in domoticz. For example thermostats supported by rfxcom also don't work yet

Re: ELV Max! Heating control system

Posted: Saturday 16 November 2013 12:58
by goedh452
maxtrash wrote:Of course that can be done with the elv max software.
It doesn't work with sliders though but can you can set a setpoint temperature.
Unfortunately there is no thermostat device yet in domoticz. For example thermostats supported by rfxcom also don't work yet
Thanks for the info!

Re: ELV Max! Heating control system

Posted: Tuesday 26 November 2013 20:34
by jteeuw
Hi,

Is there any dutch/english info on howto intall maxbuddy on a rasberry-pi ?

Re: ELV Max! Heating control system

Posted: Tuesday 03 December 2013 9:51
by jteeuw
I have max!buddy running on my raspberry Pi and want to implement the script where must I put it ?

Re: ELV Max! Heating control system

Posted: Tuesday 03 December 2013 23:49
by maxtrash
I haven't installed max!buddy on the raspberry so I can't really help. It's still on my todo-list but haven't decided when to do this. I suspect the easiest solution would be to also install the software on a windows pc. The scripts are in a scripts-subdirectory of the main directory. Maybe you can copy the setup-file from windows to the raspberry?

Re: ELV Max! Heating control system

Posted: Wednesday 04 December 2013 10:16
by maxtrash
I think I've got it working. It was not that easy getting maxbuddy to run on the PI. Did you also have to do stuff with links-914.xml to get it to use 1.4.0?

Code: Select all

<linklist>
  <firmware min="270" max="275" />

  <set checksums="http://www.max-portal.elv.de/maxupdate/digest.txt">
    <ext>http://www.max-portal.elv.de/maxupdate/lib/MaxEssentialsBackend-1.4.0.jar</ext>
    <ext>http://www.max-portal.elv.de/maxupdate/lib/MaxLocalBackend-1.4.0.jar</ext>
  </set>
  <!--
  <set checksums="http://www.max.eq-3.de/maxupdate/digest.txt">
    <ext>http://www.max.eq-3.de/maxupdate/lib/MaxEssentialsBackend-1.3.8.jar</ext>
    <ext>http://www.max.eq-3.de/maxupdate/lib/MaxLocalBackend-1.3.8.jar</ext>
  </set>
  -->
</linklist>
and then I made the file read-only.


Anyway, after that put the script in .maxbuddy\scripts
have a look at the settings file in .maxbuddy
it should look something like this:

Code: Select all

#MAX!Buddy Settings File
#Wed Dec 04 10:08:23 CET 2013
connection.refresh=60
settings.version=1
connection.reconnect=55
script.enabled.Domoticz.js=true
connection.disconnect=1
connect.lastport=62910
connect.lastip=192.168.1.46

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 9:55
by jteeuw
Hi maxtrash,

I tough i had maxbuddy runing i followd the http://bugs.maxbuddy.de/boards/1/topics/1472 threat. i did not change the links-914.xml file.

i put the script (domoticz.js ) in the /usr/local/maxbuddy/scripts directory, and changed the settings file, but there is no hardware in domoticz.

output from headless :

[2013-12-05 08:45:32,553] [DEBUG]: MAXBuddy.run([-headless])
[2013-12-05 08:45:32,617] [DEBUG]: Settings#upgradeSettings()
[2013-12-05 08:45:32,827] [DEBUG]: Settings#flush()
[2013-12-05 08:45:32,971] [DEBUG]: Settings dump:
[2013-12-05 08:45:32,984] [DEBUG]: connect.lastport=62910
[2013-12-05 08:45:32,989] [DEBUG]: script.enabled.Domoticz.js=true
[2013-12-05 08:45:32,995] [DEBUG]: export.push.enabled=true
[2013-12-05 08:45:33,000] [DEBUG]: export.push.interval=1
[2013-12-05 08:45:33,006] [DEBUG]: export.push.url=http://192.168.1.15/cube/export
[2013-12-05 08:45:33,011] [DEBUG]: connect.lastip=192.168.1.10
[2013-12-05 08:45:33,017] [DEBUG]: settings.version=1
[2013-12-05 08:45:33,022] [DEBUG]: Searching for MAX!Cube...
[2013-12-05 08:45:33,227] [DEBUG]: Sending datagram to 255.255.255.255
[2013-12-05 08:45:33,249] [DEBUG]: Sending datagram to 224.0.0.1
[2013-12-05 08:45:33,257] [DEBUG]: receive()
[2013-12-05 08:45:33,265] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,272] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,356] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,369] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,457] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,469] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,557] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,570] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,658] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:33,670] [DEBUG]: Received datagram, sig: eQ3Max* / fw: 0
[2013-12-05 08:45:34,318] [DEBUG]: Received datagram, sig: eQ3MaxAp / fw: 275
[2013-12-05 08:45:35,841] [DEBUG]: receive() done
[2013-12-05 08:45:35,943] [DEBUG]: Detected cube(s): 1
[2013-12-05 08:45:36,006] [DEBUG]: Settings#flush()
[2013-12-05 08:45:36,697] [ INFO]: LiveCubeConnection(192.168.1.10, 62910, true)
[2013-12-05 08:45:37,166] [DEBUG]: controller connect...
[2013-12-05 08:45:37,487] [DEBUG]: gateway fetchMaxCubeState()
[2013-12-05 08:45:37,970] [DEBUG]: getRawState().getHeader()
[2013-12-05 08:45:38,126] [DEBUG]: refresh()
[2013-12-05 08:45:40,183] [DEBUG]: updateRadiatorThermostatTemperatures()
[2013-12-05 08:45:40,217] [DEBUG]: updateWallThermostatTemperatures()
[2013-12-05 08:45:40,223] [DEBUG]: controller.cubeState()
[2013-12-05 08:45:40,229] [ INFO]: Connection established, serial: JEQ0540567, fw: 275
[2013-12-05 08:45:40,235] [DEBUG]: Hacking AdvancedHeatingDeviceState @ Radiator Thermostat 3

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 10:02
by maxtrash
This looks good, however the domoticz script is not enabled. My settings are in a .domoticz folder (mind the period)?

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 10:51
by jteeuw
maxtrash wrote:This looks good, however the domoticz script is not enabled. My settings are in a .domoticz folder (mind the period)?
Do yo mean ni have to enable scripts in domoticz ?

I have enabled the scritpt in mabx buddy : 2013-12-05 08:45:32,989] [DEBUG]: script.enabled.Domoticz.js=true

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 12:24
by maxtrash
No, you don't have to do anything in domoticz. If I look at your log it doesn't even find the script. It should say loading...

I think both the settings file and the scripts are in the wrong place.
They should be in a hidden directory that starts with a period. So you have two directories below user pi : domoticz and .domoticz

I'm at work now but can give screenshots later if needed

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 17:14
by jteeuw
Oke if you can post the screen shots, that would be nice!

Re: ELV Max! Heating control system

Posted: Thursday 05 December 2013 17:58
by maxtrash
does this help?

Image
Image

Re: ELV Max! Heating control system

Posted: Friday 06 December 2013 10:51
by jteeuw
That did the trick , i can see the diveces now.

Now its wating for somebuddy to implement a heating system in domoticz :-)

Re: ELV Max! Heating control system

Posted: Monday 20 January 2014 0:30
by gdekeijzer
Hello,

Hooking up here. Started my domoticz project. For starters, i bought one thermostate and a cube.
Having MAX!Buddy running on pi as stated above, no errors, but i dont see devices appear on Domoticz?

Where to start searching for them?

Re: ELV Max! Heating control system

Posted: Monday 20 January 2014 0:38
by maxtrash
gdekeijzer wrote:Hello,

Hooking up here. Started my domoticz project. For starters, i bought one thermostate and a cube.
Having MAX!Buddy running on pi as stated above, no errors, but i dont see devices appear on Domoticz?

Where to start searching for them?
what does the maxbuddy log tell you?

Re: ELV Max! Heating control system

Posted: Monday 20 January 2014 0:55
by gdekeijzer
Ah, working now. Had to do with Domoticz not accepting connecion from script
Changed local address to actual IP and that works now!!

Now indeed waiting for someone to implement a proper heating function. Perhaps me ;)

Re: ELV Max! Heating control system

Posted: Monday 20 January 2014 20:12
by Scheffie
Hello all,

I would like to invest in the ELV Max! Heating system too.. But I have some unanswered questions

- is the elv cube in control of the whole installation and does he automatically adjust the room temperature for a room when you want it to, or should one manually set the valves positions using max buddy and close them when some thermometer has reached the setpoint? Maybe said in an other way.. Do I change temperature set points or valve positions?
- if the valves only report back their room temperatures if their valve positions are changed, how does the cube know the room temperature without a thermostat?
- when using the valves in combination with domoticz/max buddy, are the "+" editions of any use? Do they report back their temperature more often (since they are a valve combined with a thermostat?)
- if I have a room with multiple radiators. Should I combine these with a thermostat (using simple valves) and set the room temperature on the thermostat instead of the actual valves?

I hope some of you can help me with these questions.. I want to be sure to buy a system that fits my needs :-)
The reported room temperatures would be necessary to control a modified on/off kaku switch to control the central heating system (emulating the old thermostat)

Tnx in advance!
Bart