Luxtronic Heatpump controller

For heating/cooling related questions in Domoticz

Moderator: leecollings

Aandegrens
Posts: 23
Joined: Saturday 08 April 2017 19:36
Target OS: Windows
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by Aandegrens »

Is this the only error you are getting.
Comment that part out and try the rest.
vaevictis
Posts: 12
Joined: Thursday 26 May 2016 7:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by vaevictis »

Aandegrens wrote:Is this the only error you are getting.
Comment that part out and try the rest.
All lines are giving the same error. How can I deduct what value is for what field? I have a Alpha Innotec WSZ heatpump.
Aandegrens
Posts: 23
Joined: Saturday 08 April 2017 19:36
Target OS: Windows
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by Aandegrens »

I can't help you any further because i'm not a Python specialist.
Are you using Python 3.4.2?
It looks like the following part doesn't works correctly:

Code: Select all

stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in range(len):
    array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
I've got it working with trail and error.
At least you can get de data from the heatpump and that's the first step.

I checked the values by comparing them directly with the values shown on the display of the heatpump.
vaevictis
Posts: 12
Joined: Thursday 26 May 2016 7:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by vaevictis »

Aandegrens wrote:I can't help you any further because i'm not a Python specialist.
Are you using Python 3.4.2?
It looks like the following part doesn't works correctly:

Code: Select all

stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in range(len):
    array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
I've got it working with trail and error.
At least you can get de data from the heatpump and that's the first step.

I checked the values by comparing them directly with the values shown on the display of the heatpump.
Yes python 3.4.2, anyone else? It seems that index of the array is invalid somehow.
vaevictis
Posts: 12
Joined: Thursday 26 May 2016 7:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by vaevictis »

Got it working! Did some cleanup of the code for Python 3.

Code: Select all

#!/usr/bin/python3.4

import socket
import struct
import datetime
import http.client

# Luxtronik 2.0 IP
hostHeatpump = '10.50.2.160'

# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8889

# Empty variables
leng = 0
array_calculated = []

s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))

if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print("Error: REQ_CALCULATED CMD")
        exit()

stat = struct.unpack( '!i', s.recv(4))[0]
leng = struct.unpack( '!i', s.recv(4))[0]


for i in range(leng):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])

print("Calculated")
print(stat)
print(leng)
print(array_calculated)
print("\n")

print("Temperatuur buiten : ", array_calculated[15] /10)
print("Temperatuur voorloop : ", (str(float(array_calculated[10])/10)))
print("Temperatuur naloop : ", (str(float(array_calculated[11])/10)))
print("Terugloop Doel : ", (str(float(array_calculated[12])/10)))
print("WQ ingangs temp : ", (str(float(array_calculated[19])/10)))
print("WA uitgang temp : ", (str(float(array_calculated[20])/10)))
print("Bedrijfstijd Verdichter 1 : ", (str(datetime.timedelta(seconds=int(array_calculated[56])))))
print("Impuls VD1 : ", (str(array_calculated[57])))
print("Bedrijfsuren WP : ", (str(datetime.timedelta(seconds=int(array_calculated[63])))))
print("Bedrijfsuren Verwarming : ", (str(datetime.timedelta(seconds=int(array_calculated[64])))))
print("Verbruik verwaming (kWh) : ", (str(float(array_calculated[151])/10)))
print("Verbruik heet water (kWh) : ", (str(float(array_calculated[152])/10)))
print("Bedrijfsuren WW groei : ", (str(datetime.timedelta(seconds=int(array_calculated[65])))))
print("Status regel 1 (code) : ", (str(array_calculated[117])))
print("Status regel 2 (code) : ", (str(array_calculated[118])))
print("Status regel 3 (code) : ", (str(array_calculated[119])))
print("Status sinds : ", (str(datetime.timedelta(seconds=int(array_calculated[120])))))
print("WMZ doorloop l/h : ", (str(float(array_calculated[155]))))

#Haven't got this below running yet.
#conn = httplib.HTTPConnection("192.168.1.5:8080")
#conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&svalue=" + (str(float(array_calculated[151])*100)))
# res = conn.getresponse()
#print res.status, res.reason

s.close()
~

poostrom
Posts: 16
Joined: Tuesday 26 January 2016 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Gorinchem - Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by poostrom »

I didn't see any replies since the last couple of months ;)

Anyway, I've got it working all the way. I didn't use the kWh anymore, since the values are not not electrical kWh's but heating, so there is a huge difference between these values and the actual electrical power consuming....
See the attachments for temperatures, which is working fine ;)
Attachments
2017-06-12 16_02_22-Domoticz.jpg
2017-06-12 16_02_22-Domoticz.jpg (77.21 KiB) Viewed 6182 times
Last edited by poostrom on Monday 12 June 2017 16:03, edited 1 time in total.
vaevictis
Posts: 12
Joined: Thursday 26 May 2016 7:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by vaevictis »

poostrom wrote:I didn't see any replies since the last couple of months ;)

Anyway, I've got it working all the way. I didn't use the kWh anymore, since the values are not not electrical kWh's but heating, so there is a huge difference between these values and the actual electrical power consuming....
See the attachments for temperatures, which is working fine ;)
Can you share your code?
poostrom
Posts: 16
Joined: Tuesday 26 January 2016 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Gorinchem - Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by poostrom »

Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
tweakertje
Posts: 15
Joined: Saturday 18 March 2017 9:05
Target OS: -
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by tweakertje »

Hi,
I´m trying to get the switch working but it keeps logging I want only the changes in the log not every minute when the script runs.

this is my json
conn.request("HEAD","/json.htm?type=command&param=switchlight&idx=327&switchcmd=Set%20Level&level=" + (str(array_calculated[119])))



2017-10-27 21:09:02 StartBlokkering
2017-10-27 21:08:02 StartBlokkering
2017-10-27 21:07:02 StartBlokkering
2017-10-27 21:06:02 StartBlokkering
2017-10-27 21:05:02 StartBlokkering
2017-10-27 21:04:02 CV
2017-10-27 21:03:02 CV
2017-10-27 21:02:02 CV
2017-10-27 21:01:03 CV
2017-10-27 21:00:04 CV
2017-10-27 20:59:03 CV

poostrom, how is yours???

when I use yours it responde with an OK but threre is nothing changed...

conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=327&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))

please help...
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

Can someone provide instructions how to get this working for a noob with raspberry and python?
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

poostrom wrote: Monday 12 June 2017 16:09 Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
Hi, could you help to get this working in Domoticz? What should I do with this code? Snap er de ballen van..
Ronker
Posts: 5
Joined: Saturday 10 March 2018 7:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Luxtronic Heatpump controller

Post by Ronker »

poostrom wrote: Monday 12 June 2017 16:09 Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
The script doesn't get the output that you earlier showed on the picture. I cant find the kWh in the script could you explain? Sorry my bad didn't read your text from the picture message
Last edited by Ronker on Saturday 10 March 2018 7:40, edited 1 time in total.
Ronker
Posts: 5
Joined: Saturday 10 March 2018 7:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Luxtronic Heatpump controller

Post by Ronker »

Wiljums wrote: Friday 09 March 2018 21:08
poostrom wrote: Monday 12 June 2017 16:09 Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
Hi, could you help to get this working in Domoticz? What should I do with this code? Snap er de ballen van..
In hardware you can add a dummy and than add virtual sensors. If you did this you can see the virtual sensor in devices.
Every virtual sensor gets an IDX copy this and place it where I put the star *
# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[*])/10)))



To get output from the script you can create a cron job that is running every minute.

You can send me a pm if you want.
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

I also found this piece of software: https://github.com/coolchip/luxtronik2
In the code you find: 'Read all readable data'. So it might extract more data than the tool in this forum.

Which one is better do you think?
poostrom
Posts: 16
Joined: Tuesday 26 January 2016 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Gorinchem - Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by poostrom »

Ronker wrote: Saturday 10 March 2018 7:35
Wiljums wrote: Friday 09 March 2018 21:08
poostrom wrote: Monday 12 June 2017 16:09 Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
Hi, could you help to get this working in Domoticz? What should I do with this code? Snap er de ballen van..
In hardware you can add a dummy and than add virtual sensors. If you did this you can see the virtual sensor in devices.
Every virtual sensor gets an IDX copy this and place it where I put the star *
# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[*])/10)))



To get output from the script you can create a cron job that is running every minute.

You can send me a pm if you want.
You placed the star at the wrong position. array_calculated[*] is the place in the array being read from the luxtronik. You should leave that. You should change the udevice&idx=924 to the right device in Domoticz. So 924 should be changed to whatever ID is being used in your own virtual sensor ;)
poostrom
Posts: 16
Joined: Tuesday 26 January 2016 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Gorinchem - Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by poostrom »

Hi,

Interesting ;)

My script (carefully stolen) only reads stuff. It actually reads everything from the Luxtronik, but I use just the things I want to...
The interesting about this script is that it can actually send commands to the Luxtronik. So in theory you should be able to change values through Domoticz...
See if I can make it work :)

Regards,
Patrick
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

poostrom wrote: Thursday 29 March 2018 11:11 Hi,

Interesting ;)

My script (carefully stolen) only reads stuff. It actually reads everything from the Luxtronik, but I use just the things I want to...
The interesting about this script is that it can actually send commands to the Luxtronik. So in theory you should be able to change values through Domoticz...
See if I can make it work :)

Regards,
Patrick
Have you got it working?
poostrom
Posts: 16
Joined: Tuesday 26 January 2016 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Gorinchem - Netherlands
Contact:

Re: Luxtronic Heatpump controller

Post by poostrom »

Hi Wiljums,

It's working. You need to install nodered for it (and the other stuff for the luxtronik as well). (I only looked at setting values, not reading, though that works as well).

The only thing I made working is the + and - temperature setting. I made a virtual selector switch and every step runs a script from domoticz. Bit complicated, but I don't have the knowledge how to integrate it. You can have node talk to MQTT which talks to Domoticz, but really don't know how that works. I only needed the + and - temp setting, so it works...

The action on the selector switch in Domoticz:
script:///home/pi/domoticz/scripts/node/temp+10.sh

and the content of the shell script temp+10.sh:
node /home/pi/domoticz/scripts/node/temp+10.js
The temp+10.sh needs to be executable

and the content of the node script temp+10.js:
const luxtronik = require('/home/pi/node_modules/luxtronik2/luxtronik');

/* eslint no-console: "off" */
const pump = luxtronik.createConnection('192.168.200.145', 8888);

pump.write('heating_target_temperature', 1, function (err, data) {
if (!err) {
console.log(data);
}
});


The '1' after target temperature is the setting, so either 0,1,2,3,4,5 or -1,-2,-3,-4,-5
The luxtronik doesn't go beyond +5 or -5 degrees.

Good luck ;)
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

An overview of all possible measures and ID's: https://www.loxwiki.eu/pages/viewpage.a ... d=18219334
Wiljums
Posts: 28
Joined: Sunday 11 February 2018 21:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Luxtronic Heatpump controller

Post by Wiljums »

Poostrom, I have your script working, except reading the current function of the heatpump. Is there anything special I have to do in setting up the switch?
poostrom wrote: Monday 12 June 2017 16:09 Sure ;)

Code: Select all

#!/usr/bin/python

import socket
import struct
import datetime
import httplib

#####################
# Luxtronik 2.0 IP
hostHeatpump = '192.168.200.107'
# Luxtronik 2.0 port (standard 8888)
portHeatpump = 8888
#####################


s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)
s.connect( (hostHeatpump, portHeatpump))

######################################################
s.send( struct.pack( '!i', 3004))
s.send( struct.pack( '!i', 0))
if struct.unpack( '!i', s.recv(4))[0] != 3004:
        print 'Error: REQ_CALCULATED CMD'
        exit()
stat = struct.unpack( '!i', s.recv(4))[0]
len = struct.unpack( '!i', s.recv(4))[0]
array_calculated = []
for i in xrange(len):
        array_calculated.append(struct.unpack( '!i', s.recv(4))[0])
s.close ()

# Temp buiten
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=924&nvalue=0&svalue=" + (str(float(array_calculated[15])/10)))

# Temp aanvoer
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=188&nvalue=0&svalue=" + (str(float(array_calculated[10])/10)))

# Temp retour
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=189&nvalue=0&svalue=" + (str(float(array_calculated[11])/10)))

# Bron in
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=190&nvalue=0&svalue=" + (str(float(array_calculated[19])/10)))

#Bron uit
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=191&nvalue=0&svalue=" + (str(float(array_calculated[20])/10)))

#Heet water temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=200&nvalue=0&svalue=" + (str(float(array_calculated[17])/10)))

#Heet gas compressor temperatuur
conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=udevice&idx=229&nvalue=0&svalue=" + (str(float(array_calculated[14])/10)))

# Lees huidige functie warmtepomp
if array_calculated[119] == 1: array_calculated[119] = '0'
if array_calculated[119] == 0: array_calculated[119] = '10'
if array_calculated[119] == 5: array_calculated[119] = '20'
if array_calculated[119] == 10: array_calculated[119] = '30'
if array_calculated[119] == 15: array_calculated[119] = '30'

conn = httplib.HTTPConnection("192.168.200.15:8080")
conn.request("HEAD","/json.htm?type=command&param=updateuservariable&idx=5&vname=warmtepomp_functie&vtype=uservariabletype&vvalue=" + (str(array_calculated[119])))
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest