ELV Max! Heating control system

For heating/cooling related questions in Domoticz
User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: ELV Max! Heating control system

Post by Westcott » Tuesday 19 September 2017 20:12

Hi Peggy and Mvzut,

Thanks for the interest!
This is just one module from my Python Domoticz helper.
I wrote the helper to handle all of the network and internet action previously done in Lua.
Now I have 'proper' error handling and retries, no more Lua 10 second time-outs (times-out?).

Read() is called every 5 minutes by a scheduler in the main helper.
SetSetpoint() is called when Domoticz Lua sends the appropriate command to the helper.

'UTILS' is my library of utility functions.
'LOG' is my own logging class.
'mconfig' is the MaxCube section of the helper's config file.

UTILS.UpdateDevice() sends a Json update to Domoticz.
UTILS.SendMessage() sends to the Domoticz log.
LOG.Log() writes to the helper's logfile and console.

Peggy, that definitely looks like the library I used.
There would be no problem adjusting the setpoint either way.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Wednesday 20 September 2017 1:57

Westcott,

1) Question 1 : would you mind sharing your helper? At least UTILS and the MaxCube section of your helper's config file. The whole helper may be ideal.
I plan to code my script this week end, based on your work. I don't care if half of your code is not appropriate. I'll "clean" it by myself.

2) Question 2 : Why did you comment this : self.UTILS.UpdateDevice(name + ' mode', smode + "|" + str(dmode))
Last edited by Peggy on Wednesday 20 September 2017 10:26, edited 2 times in total.

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: ELV Max! Heating control system

Post by Westcott » Wednesday 20 September 2017 11:59

Hi Peggy,

Attached file has the bits you want (I think!)
The commented-out line used to update the valve's 'mode' in Domoticz.
I took it out because I only use 'manual' mode.
Attachments
python.rar
Westcott's Domoticz helper
(15.18 KiB) Downloaded 38 times
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Wednesday 20 September 2017 13:53

Your work is a gold mine, truly. I'll rewrite most of my eventghost scripts in order to use your Domoticz library which looks very well optimized. I wonder why you delete old devices every ten minutes, doing this so often looks overkill. Anyway, it is nice.
I'm curious to know what is physically behind your sonoff and OLED methods. I use 15 sonoff using Tasmota's firmware, which is HTTP and MQTT compatible.
Concerning the oled, did you describe your setup somewhere on internet?

Thank you, sincerely.

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: ELV Max! Heating control system

Post by Westcott » Wednesday 20 September 2017 18:35

Hi Peggy,
Thanks for the kind words (blush)!
The old device delete scheduler in RunDeleted() runs every 30 mins.
The call sch.enter(15, 1, RunDeleted) runs just once, 15 seconds after it is called, so the background processes don't all start at once, but at 5 sec intervals.
My Sonoffs all run ESPeasy 147 and use HTTP directly - no MQTT.
The OLED is a standard .96" I2C module connected to the PRi that runs Domoticz and the helper. It was plug and play using the libraries in OLED.py.
They came with "FreeSans.ttf" but you can use any font you fancy.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Thursday 21 September 2017 5:09

All right, after a few hours of tuning, mvzut's script seems working, Westcott's too. I can't test much because the cube is running with no device. :lol:
The question now is : can I use mvzut's script for the device creation, then Westcott's one for the sync? Does they both use the same ID logic? I can't confirm. The suspens is maximum, as I should get the valve friday or later.

Westcott uses this :

Code: Select all

def UpdateDevice(self, name, val):
        if name in self.svalues:
            if "|" in str(val):
                val, val2 = val.split("|")
            else:
                val2 = val
                
            if val != self.svalues[name]:
#                print("{} {} -> {}".format(name, self.svalues[name], val2))
                data = "command&param=udevice&idx={}&svalue=" + str(val2)
                self.SendCommand(name, data)
                self.svalues[name] = str(val)
        else:
            self.SendAll("Unknown device '{}'".format(name))
But I don't understand how the device idx is known.

I could see in checkonline :

Code: Select all

self.UpdateDevice(name, macip)
self.svalues[name] = macip
And somewhere else :

Code: Select all

def SendCommand(self, name, cmd):
        if name in self.indexes:
            idx = self.indexes[name]
            data = cmd.format(idx)
            threading.Thread(target=self.DomoticzData, args=(data,)).start()
        else:
            self.SendAll("No IDX for '{}'".format(name))
To be honnest I don't understand the checkonline method.

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: ELV Max! Heating control system

Post by Westcott » Thursday 21 September 2017 11:17

Hi Peggy,
Yes, it is confusing, isn't it?
My helper is based on Egregius' Pass2php.
The main difference is that my 'script' runs continuously as a service.
Domoticz Lua sends all device data to my helper, including name-to-idx table.
This is held in the Python dictionary 'indexes'
Lua -

Code: Select all

function Utils.SendToPython(device, ddata, force)
--print("Start")
	if (otherdevices['Python helper'] == 'On' or (force and force == true)) then

		data = {}
		
		if device and ddata then
			d = {}
			d[device] = ddata
			data['changed'] = d
		elseif devicechanged then
			data['changed'] = devicechanged
		end
		
		for deviceName, deviceValue in pairs(data['changed']) do
			device = deviceName
			val = deviceValue
			print("⇒ "..device..' = '..val..' ⇒')
		end


		data['svalues']    = otherdevices
		data['indexes']    = otherdevices_idx
		data['lastupdate'] = otherdevices_lastupdate
		data['vvalues']    = uservariables
		data['vupdate']    = uservariables_lastupdate
		
		PassToPython(data)
	else
		print("-- Python offline --")
	end
end

function PassToPython(data)
	if not JSON then
		JSON = require "cjson"
	end
	
	jdata = JSON.encode(data)

	package.loadlib("core.so", "*")
	local Socket = require "socket"

	local client = Socket.connect('localhost', 8088)
	
	if not client then
		print("Python socket connect failed")
		return
	else
	
		client:settimeout(2)
		
		i, status = client:send(jdata);
	
		if not i then
			print("Python send failed - "..status)
		else
			s, status, partial = client:receive(1024)
			reply = JSON.decode(s or partial)
--				print("Status = "..reply['status'])
		end
	end

	client:close()
	return reply
end
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Thursday 21 September 2017 11:44

Hum,

Then I'll have to dig more on your stuff. If I understand :

1 - I need to add a new LUA script in domoticz , the one you just published above. This One will open a socket.
2 - I have to un-comment the do-while that was locking my app (eventghost), and launch the helper as a thread so that it keeps persistent.

I start to understand why the "battery" method didn't show anything. Only the "delete" method is functionnal for now.

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Friday 22 September 2017 8:05

I installed your LUA in domoticz as a device script, I get an error saying that UTIL is not defined or something like that. I don't catch this syntax : UTIL.MyMethodName

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Tuesday 24 October 2017 12:03

Hi,
I have, maybe a stupid quiestion. I have a few eq-3 max basic radiatiors and lan cube. I'am quite happy with this configuration except one thing.
They all have internal temp sensors and I have fake temperatures. I have a few esp8266 temp modules and want to use them. Is it possible to change somehow to convince them to use external temperature sensors ?
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Tuesday 24 October 2017 12:37

No, as far as I know it is not possible.

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Tuesday 24 October 2017 12:40

........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Tuesday 24 October 2017 12:43

Yes

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Thursday 26 October 2017 20:30

Helo,
I desperatly looking for help with my eq3 max! integration. First, I have started with php scripts from different topic. Everything was ok until I connected wall thermostats. Then everything stoped working. There is a bug with reading data from a cube. Unfortunetly I dont know how to repair it and an author of this was active on forum last time in april :-(
So I switch to lua version from wiki. Devices created, even updates working but I dont know how to send a new setpoint to thermostats :-( I feel stupid.
I want just simple set a temperture from domoticz :-)
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

bilbolodz
Posts: 11
Joined: Wednesday 15 March 2017 10:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by bilbolodz » Thursday 26 October 2017 20:39

You can try: MAX! HOME AUTOMATION

http://www.dmitry-kazakov.de/ada/max_ho ... mation.htm

It has GUI, integrated web server and MQTT.
If you want "simple set temperature" you can try to sniff communication between MAX (original) application and Cube and then replay it using netcat (working).

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Thursday 26 October 2017 20:59

Ok, Its looks like this is simpler solution :-) https://github.com/Juerd/eq3-max
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Friday 27 October 2017 6:56

Starting from this need :
I want just simple set a temperture from domoticz
The simplest and easiest solution is mvzut's lua script. It's been working for 1 month here, so far so good.

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Friday 27 October 2017 9:03

Yes, you are right :-) I had some problems with this script but now its working without problem. Superb job !!!! :D
I have only one question. Now every action is sent to cube every 5 minutes. It's ok when we are only reading data from cube but not enought when I want to change valves. Is it possible to change it ??? 5 minutes to read data from cube and immediatelly after I change something from domoticz side ?
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

Peggy
Posts: 25
Joined: Saturday 09 September 2017 23:38
Target OS: Windows
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by Peggy » Friday 27 October 2017 9:27

Then you need to trigger the script after any manual change in domoticz. It is doable but Idk how, being under Windows things are a bit different.

kluczus
Posts: 22
Joined: Tuesday 12 September 2017 14:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: ELV Max! Heating control system

Post by kluczus » Friday 27 October 2017 16:22

Ok, thank you for tips. Finally I have working system :-)
I have used a max command from previous post. Its triggered as you suggested :-)
........................................................................................
RPi2 + sonoff + 433MHz + Xiaomi Gateway + EQ-3 MAX!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest