Skip to content

Latest commit

 

History

History
134 lines (110 loc) · 6.32 KB

README.md

File metadata and controls

134 lines (110 loc) · 6.32 KB

Valden Heat Pump integration example

This example shows how to access the Valden Heat Pump data from your server, Raspberry Pi, and so on.

All you need is a USB->RS485 converter and python2 installed.
Connect your computer to RS485 line as pictured below, connect another side of wire like described at Valden Display page and run python script from an example below.
Remember, RS485 is a 3-wire line. Do not use cheap converters without "signal ground" and with only A and B. They'll work for a few meters distances.




# Communication example for:
# - Valden Display  https://github.com/openhp/Display/
# - Valden Service Display https://github.com/openhp/ServiceDisplay/
#
# The source code licensed under GPLv3.
#
# This product is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.


import serial
from time import sleep
import datetime
import string
import sys

#-------------------------------------------------------
#function to send commands and print answers
def SendCommand(ID_to, command):
	#send command
	towrite = str(ID) +  str(ID_to) + command
	print "> " + str(datetime.datetime.now())[0:19] + " we sent: " + towrite
	try:
		serial.write(towrite)
	except:		#do not catch all exceptions in a real code
		print "USB>Serial converter disconnected?", sys.exc_info()
		line = None
		return 0
		
	#read result
	try:
		line = serial.readline()   # read a '\n' terminated line
	except:		#do not catch all exceptions in a real code
		print "USB>Serial converter disconnected?", sys.exc_info()
		line = None
		return 0

	#print answer
	if len(line) > 2:
		print "< " + str(datetime.datetime.now())[0:19] + " we got: "+ line
	else:
		print "No answer from", ID_to, "\t\t", str(datetime.datetime.now())[0:19]

#-------------------------------------------------------
#open serial
print "Starting.."
try:
	serial = serial.Serial('/dev/ttyUSB2', 9600, timeout=3)		#Change serial name to yours!
	print "Opened: ", serial.name
except serial.serialutil.SerialException:
	print "Serial open error! Change serial name to yours! (ex: /dev/ttyUSB5, or something like COM9 at win)"
	exit (0)

#-------------------------------------------------------
#some example values
eev_target = "02.50"		#new eev temperature difference
newtemp = "31.50"		#new setpoint temperature

ID 	= chr(0x30)		#this script ID, 0x30 by default, default value supported by all Valden components so do not change it
remote_ID = chr(0x41)		#Remote Display ID ( this display https://github.com/openhp/Display/ or that display https://github.com/openhp/ServiceDisplay/ )
				#Remote Display ID can be changed, and yes: few devices with unique IDs can work together at the same time at same line

#-------------------------------------------------------
#example cycle, interaction with Remote Display
#commands: 
#(G)et all 
#new (T)emperature set (setpoint) 
#new (E)EV difference set


#cycle sends 10 times (G)er all command
#then sends (T)emperature set 
#then sends (E)EV difference set
#then cycle


while ( 1 == 1):
	for i in xrange (10):
		SendCommand(remote_ID,"G")	#sends 0AG : from ID 0 to ID A (G)et all
		sleep (5)
	SendCommand(remote_ID,"T" + newtemp)	#sends 0AT31.50, command format TNN.NN
	sleep (5)
	SendCommand(remote_ID,"E" + eev_target)	#sends 0AE02.50, command format ENN.NN
	sleep (5)

Script output example (click to enlarge):


Short names (keys) specific for JSON communication:

Abbr. Full name
A1 setpoint
E1 error code
HPC Heat Pump connected (to remote display, 1=yes, 0=no)
W1 Watts

All abbreviations and status messages you'll see at the display are listed at the Valden Heat Pump Controller appendix. Error codes also there.

What's next? You have all information you need to integrate, for example, with Home Assistant or another "Smart Home" system you like. Just parse gotten strings (that's very easy in a python) and feed key-value pairs to your favorite system.
I do not use "smart home" systems, but I like graphs. Graphs help to analyze processes dynamics. So, I have a script (much more complicated script) on the server side, that get stats from all of my devices and draw graphs for me.

For example, daily graph for one of my Heat Pumps (click to enlarge):
daily graph example
To get graphs you can use something like Cacti monitoring system.

And one more: you can use "set temperature" commands to automatically change "setpoint" temperature to create a comfortable balance between power saving and house temperature. Or day-dependent, hour-dependent or something-else temperature dependent system.

License

© 2015-2021 D.A.A. All rights reserved; gonzho AT web.de; https://github.com/openhp/HP-integration-example/.

Text, media and other materials licensed under CC-BY-SA License v4.0.
Attribution: You must clearly attribute Valden Heat Pump integration (https://github.com/openhp/HP-integration-example/) original work in any derivative works.
Share and Share Alike: If you make modifications or additions to the content you re-use, you must license them under the CC-BY-SA License v4.0 or later.
Indicate changes: If you make modifications or additions, you must indicate in a reasonable fashion that the original work has been modified.
You are free: to share and adapt the material for any purpose, even commercially, as long as you follow the license terms.

The source code licensed under GPLv3.
This product is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

For third-party libraries licenses used in this product please refer to those libraries.

Author


gonzho АТ web.de (c) 2015-2021