此示例顯示瞭如何從服務器,Raspberry Pi等訪問Valden熱泵數據等。
您需要的只是安裝了USB-> RS485轉換器和Python2。
如下圖所示,將計算機連接到RS485線,將電線的另一側連接,如Valden顯示頁面所述,並從下面的一個示例中運行Python腳本。
請記住,RS485是一條3線線。不要使用沒有“信號接地”的便宜轉換器,只有A和B。它們將工作幾米距離。


# 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 )腳本輸出示例(單擊放大): 
JSON通信特定的簡短名稱(鍵):
| abbr。 | 姓名 |
|---|---|
| A1 | 設定點 |
| E1 | 錯誤代碼 |
| HPC | 連接熱泵(到遠程顯示,1 =是,0 =否) |
| W1 | 瓦特 |
您將在顯示屏上看到的所有縮寫和狀態消息均在Valden熱泵控制器附錄中列出。錯誤代碼也在那裡。
接下來是什麼?您擁有所有需要集成的信息,例如,與家庭助理或您喜歡的另一個“智能家庭”系統。只是解析琴弦(在Python中非常容易),然後將鍵值對饋送到您喜歡的系統。
我不使用“智能家居”系統,但我喜歡圖形。圖有助於分析過程動態。因此,我在服務器端上有一個腳本(更複雜的腳本),該腳本從我所有設備中獲取統計數據並為我繪製圖形。
例如,我的一個熱泵的每日圖(單擊以放大): 
要獲取圖形,您可以使用仙人掌監測系統之類的東西。
還有一個:您可以使用“設置溫度”命令自動更改“設定點”溫度,以在節省和房屋溫度之間建立舒適的平衡。或依賴日期,小時依賴性或某種依賴溫度的系統。
©2015-2021 DAA保留所有權利; gonzho at web.de; https://github.com/openhp/hp-integration-example/。
根據CC-BY-SA許可證v4.0許可的文本,媒體和其他材料。
歸因:您必須清楚地歸因於valden熱泵集成(https://github.com/openhp/hp-integration-example/)在任何衍生作品中的原始作品。
共享和共享:如果您對重複使用的內容進行修改或添加,則必鬚根據CC-BY-SA許可證v4.0或更高版本許可它們。
指示更改:如果進行修改或添加,則必須以合理的方式表明原始作品已被修改。
您可以免費:只要您遵守許可條款,就可以在商業上分享並適應任何目的。
根據GPLV3許可的源代碼。
該產品的分發是希望它將有用的,但沒有任何保證;即使沒有對特定目的的適銷性或適合性的隱含保證。有關更多詳細信息,請參見GNU通用公共許可證。
對於本產品中使用的第三方庫許可,請參考這些圖書館。