Hey guys,
I have a Daikin Altherma Hybrid heating system with a LAN adaptor which can be read via Websockets. I was thinking of using the Virtual Sensor plugin in combination with some Lua code started by Reactor as a quick and easy way to build an Daikin app. Would this be possible and indeed a simple way and if so could anyone help me out with some pointers or code to help me here?
I include an example in Python:
from websocket import create_connection
import json, datetime, time, urllib2, urllib
ts = time.time()
timestamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
ws = create_connection("ws://192.168.2.4/mca")
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/1/Sensor/TankTemperature/la\",\"fr\":\"/TarmoTest\",\"rqi\":\"xijub\"}}")
result1 = json.loads(ws.recv())
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/1/Operation/TargetTemperature/la\",\"fr\":\"/TarmoTest\",\"rqi\":\"yssyq\"}}")
result2 = json.loads(ws.recv())
#print("Received temp '%s'" % result1)
#print("Received target '%s'" % result2)
tankTemperature = result1["m2m:rsp"]["pc"]["m2m:cin"]["con"]
tankTargetTemperature = result2["m2m:rsp"]["pc"]["m2m:cin"]["con"]
urllib2.urlopen("http://xxxxx.yy/recv.php?timestamp=" + urllib.quote_plus(str(timestamp)) + "&type=daikinTankTemp&measurementValue=" + str(tankTemperature))
urllib2.urlopen("http://xxxxx.yy/recv.php?timestamp=" + urllib.quote_plus(str(timestamp)) + "&type=daikinTankTargetTemp&measurementValue=" + str(tankTargetTemperature))
ws.close()