Page 9 of 37

Re: ELV Max! Heating control system

Posted: Monday 04 April 2016 11:26
by Rostikator
thanks

Re: ELV Max! Heating control system

Posted: Thursday 07 April 2016 8:11
by Rostikator
How to add Max! wall sensors or radiator sensors to floor plan ?

I see sensors in devices and sensors are added as used.
devices list.png
devices list.png (111.98 KiB) Viewed 3493 times
but in room plan edit I see only devices from rflink.
room edit.png
room edit.png (59.19 KiB) Viewed 3493 times
Thanks for help

R

Re: ELV Max! Heating control system

Posted: Thursday 07 April 2016 11:02
by blackdog65
Hiya, :D

The ELV Max! isn't (yet) seen directly by domoticz. You need to create a dummy device in hardware, mine is called "EQ3" and note its idx (left column) then in the .maxbuddy/scripts folder, edit the .js file to your ip/port and the dummy idx/HID.

See here viewtopic.php?f=34&t=841&start=20#p15912 for some better advice/tips.

Then your ELV Max! devices should start to show in devices. A word of advice, add them one at a time so that you know which is which.

Sean

Re: ELV Max! Heating control system

Posted: Tuesday 26 April 2016 18:06
by Westcott
Hi all,
I'm starting to be able to read directly from the Cube using Lua and a tcp socket.
So far I can get the Cube's raw response - next to decode it in Lua.
Then to try sending an 's' command.

Huge thanks to whoever wrote the PiHeating Python code, it really got me started.

Re: ELV Max! Heating control system

Posted: Tuesday 26 April 2016 20:15
by blackdog65
Wow Westcott!
Great to hear. This section has been so lifeless recently that I almost ( almost ) decided to look into Evo Home :oops:
I look forward to seeing how you get on and trying it :D

Sean

ELV Max! Heating control system

Posted: Sunday 22 May 2016 16:07
by mvzut
Westcott wrote:Hi all,
I'm starting to be able to read directly from the Cube using Lua and a tcp socket.
So far I can get the Cube's raw response - next to decode it in Lua.
Then to try sending an 's' command.

Huge thanks to whoever wrote the PiHeating Python code, it really got me started.
Any news on this Westcott? I would love to have direct support for the Cube in Domoticz. Most other main home automation packages have it, and I really think it could boost interest in both Domoticz and the ELV Max! System.
Once you have something beta ready, I would be more than happy to help you test it.

P.S. I think I saw the code for the ELV Max! Cube binding for OpenHAB somewhere, they already worked out all the decoding. Maybe this can help? If I was a programmer myself, and if I had more time, I would have loved to help myself...
EDIT: it's at https://github.com/openhab/openhab/tree ... ng.maxcube

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 16:25
by Westcott
Hi Mvzut,

Thanks for your interest!
My Cube broke, it wouldn't power up any more.
I've returned it to Conrad, but no response yet.
Thanks for the OpenHab mention, yes I've found a couple of similar descriptions.
My decoding of a single valve is almost complete.
Once I get a working Cube again, I can move to sending commands.

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 19:10
by blackdog65
Hiya,
I think you'll find more than 1 waiting with interest :D
I'm holding my breath! :mrgreen:

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 20:07
by Westcott
Hi all of you holding your breaths,

If I post some code here, could you try it for me, please?
Unfortunately there is quite a bit of setup first, to get the necessary Lua libraries installed.

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 20:12
by mvzut
Westcott wrote:Hi all of you holding your breaths,

If I post some code here, could you try it for me, please?
Unfortunately there is quite a bit of setup first, to get the necessary Lua libraries installed.
Yes no problem, glad to contribute! Assuming you will give some explanation on the installation of the libraries.

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 20:29
by Westcott
OK, here we go.
I think this is how I did it...
First you need to update Lua to 5.2.
Then get the 'lua-socket' library, and the 'luarocks' installer/manager app.
Finally some 'luarocks' need to be installed.
The last step is a list of the installed 'rocks'.
Each step has to be successful before the next can run, I had a +lot+ of Googling to do here, and might have forgotten some bits.

Code: Select all

sudo apt-get install lua5.2
sudo apt-get install lua-socket
sudo apt-get install luarocks
sudo luarocks install luasec
sudo luarocks install luasocket
sudo luarocks install basexx

luarocks list

Installed rocks:
----------------

basexx
   0.3.0-1 (installed) - /usr/local/lib/luarocks/rocks

luasec
   0.6-1 (installed) - /usr/local/lib/luarocks/rocks

luasocket
   3.0rc1-2 (installed) - /usr/local/lib/luarocks/rocks

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 21:03
by mvzut
I got stuck at the installation of the luasec rock, it complained about openssl.a or openssl.so or openssl.so.* not found. Openssl is installed on my system, but the files appeared to be in a non-standard location. Here's what I did to solve this:

Code: Select all

sudo mkdir /usr/local/ssl
sudo cp /usr/lib/arm-linux-gnueabihf/libssl.* /usr/local/ssl
sudo luarocks install luasec OPENSSL_LIBDIR=/usr/local/ssl
Let us know when you have a script to test! ;-)

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 21:45
by Westcott
Nice one!
This might also work, before luasec -
sudo apt-get install libssl-dev

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 21:48
by mvzut
Westcott wrote:Nice one!
This might also work, before luasec -
sudo apt-get install libssl-dev
Tried that first, said it was already installed?!

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 22:18
by Westcott
Another possible way, watch out for the reverse quotes -
sudo luarocks install luasec OPENSSL_LIBDIR=/usr/lib/`gcc -print-multiarch`

Re: ELV Max! Heating control system

Posted: Sunday 22 May 2016 22:21
by mvzut
Westcott wrote:Another possible way, watch out for the reverse quotes -
sudo luarocks install luasec OPENSSL_LIBDIR=/usr/lib/`gcc -print-multiarch`
OK, but my solution was also ok, right? At least I have eveything installed now.

Re: ELV Max! Heating control system

Posted: Monday 23 May 2016 9:02
by blackdog65
Hi again,
Just installed the lua libraries (same install problem) all good to go ;)

Re: ELV Max! Heating control system

Posted: Monday 23 May 2016 20:02
by jorishp
Everything is installed. Can't wait to start testing.

Re: ELV Max! Heating control system

Posted: Monday 23 May 2016 21:23
by Westcott
Gosh, that makes - um - 3 of you!
Here is some Lua code, save it to a file somewhere, and run it interactively: 'lua yourfilename'
Then please copy the result back to here, together with a brief description of your Max devices.
You'll need to put your Cube's IP name/addr in the code.
Hopefully it will read the 'L response' ("Device List") from your cube.

Code: Select all

local socket = require "socket"
local basexx = require "basexx"

--MaxIP='172.16.176.26'
MaxIP='KEQ0817132'
MaxPort=62910

function maxCmd_H(data)
--	print('H='..data)
end

function maxCmd_M(data)
--	print('M='..data)
end

function maxCmd_C(data)
--	print('C='..data)
end

function maxCmd_L(data)
print('L='..data)
	dec = basexx.from_base64(data)
	hex = basexx.to_hex(dec)
--	print("Hex="..hex)
	s = hex:sub(1,2)
	data_len  = tonumber(s,16) + 1
	valve_adr = hex:sub(3,8)
	valve_info = hex:sub(13,14)
	batt = bit32.extract(valve_info,7,1)
	bst  = bit32.extract(valve_info,3,1)
	mode = bit32.extract(valve_info,1,2)
print("Len="..data_len, "Adr="..valve_adr, "batt="..batt, "bst="..bst, "mode="..mode)
	
    if (data_len == 13) then	-- WallMountedThermostat (dev_type 3)
print("Wall 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
		s = hex:sub(21,22)
		temp = tonumber(s,16) / 10
print("Valve pos="..valve_pos, "Setpoint="..setpoint, "Temp="..temp)
	end
	
end

local tcp = socket.connect(MaxIP, MaxPort)

if not tcp then
	print("Socket connect failed for "..MaxIP..':'..MaxPort)
	return
end

tcp:settimeout(2)

while true do
    s, status, partial = tcp:receive()
	
    if (status) then
		print("TCP receive - "..status)
		break
	end
		
    local line = (s or partial)
	local cmd  = line:sub(1,1)
	local data = line:sub(3)
	
	if (cmd == 'H') then
		maxCmd_H(data)
	elseif (cmd == 'M') then
		maxCmd_M(data)
	elseif (cmd == 'C') then
		maxCmd_C(data)
	elseif (cmd == 'L') then
		maxCmd_L(data)
		break
	end
end

tcp:close()


Re: ELV Max! Heating control system

Posted: Monday 23 May 2016 22:50
by jorishp
tried it but this is my output

Code: Select all

pi@raspberrypi ~ $ lua max.lua
lua: max.lua:1: module 'socket' not found:
	no field package.preload['socket']
	no file '/usr/local/share/lua/5.2/socket.lua'
	no file '/usr/local/share/lua/5.2/socket/init.lua'
	no file '/usr/local/lib/lua/5.2/socket.lua'
	no file '/usr/local/lib/lua/5.2/socket/init.lua'
	no file './socket.lua'
	no file '/usr/share/lua/5.2/socket.lua'
	no file '/usr/share/lua/5.2/socket/init.lua'
	no file './socket.lua'
	no file '/usr/local/lib/lua/5.2/socket.so'
	no file '/usr/lib/arm-linux-gnueabihf/lua/5.2/socket.so'
	no file '/usr/lib/lua/5.2/socket.so'
	no file '/usr/local/lib/lua/5.2/loadall.so'
	no file './socket.so'
stack traceback:
	[C]: in function 'require'
	max.lua:1: in main chunk
	[C]: in ?
pi@raspberrypi ~ $ lua
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> ^C
pi@raspberrypi ~ $ luarocks list

Installed rocks:
----------------

basexx
   0.3.0-1 (installed) - /usr/local/lib/luarocks/rocks

luasec
   0.6-1 (installed) - /usr/local/lib/luarocks/rocks

luasocket
   3.0rc1-2 (installed) - /usr/local/lib/luarocks/rocks