Closed brisc closed 3 years ago
Sorry, for the late reply, I just remembered why I did not implement it yet. I tried to understand the M2M specification on which the protocol is based and I could not figure out how to safely determine the format the needs to be sent and the code to use. Considering that I almost never change any setting on my heating unit, I decided to not implement, in case it breaks anyones unit. If you can provide some insight into how to set a value, I may try to implement it.
The most used setting that you need to modify is on/off + set Target Temperature Here is a python sample to read and write values
from websocket import create_connection
import json
// daiking lan IP
ws = create_connection("ws://192.168.1.10/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)
def setValue(ws, item, value):
ws.send("{\"m2m:rqp\":{\"op\":1,\"to\":\"/[0]/MNAE/"+item+"\",\"fr\":\"/OpenHab\",\"rqi\":\""+"xyz"+"\",\"ty\":4,\"pc\":{\"m2m:cin\":{\"con\":"+value+",\"cnf\":\"text/plain:0\"}}}}")
result1 = json.loads(ws.recv())
print("Response was: %s" % result1)
value = result1["m2m:rsp"]["rsc"]
if (value==2001):
print("Success")
return value
setValue(ws, "1/Operation/TargetTemperature", "24")
I just added that feature in 0.0.2. Please let me know if it works as expected or there are any issues.
It works as expected. Great work. BUT After you set a value to a topic, and you get the confirmation, you should force an update on that topic. Eg: you set the temperature on homie/daikin-heatingunit/spaceheating/1-operation-targettemperature/set to 25 but the value on the homie/daikin-heatingunit/spaceheating/1-operation-targettemperature will remain 23 until the next update.
Also, here is a recent project that controls the Daikin Altherma LAN adapter https://github.com/william-sy/Daikin-BRP069A62 A more complete write (set) function can be found here. https://github.com/william-sy/Daikin-BRP069A62/blob/master/DOHPC/sendHP.py
I implemented the update functionality in v0.0.3 along with minor adjustments, but I don't think I will support updating the plan right now, but may surprisingly change my mind somewhen later :) Feel free to file a new bug for the plan feature, that way I have it in my mind.
Well, turns out you can already set plans with the setter I implemented :D In order to set a plan you have to write a json like this:
{
"data": [
"$NULL|1|0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,200;,;,;,;,",
"$NULL|1|,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,",
"$NULL|1|,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,"
]
}
If you want to set a new plan, you simply have to JSON escape the json, and add " at the beginning and end. So the plan should now look like this:
"{\"data\":[\"$NULL|1|0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,210;,;,;,;,;0700,230;2100,200;,;,;,;,\",\"$NULL|1|,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,\",\"$NULL|1|,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,;,\"]}"
This should update the plan.
It should have a way to send and set a value to the unit. Currently, I do it from python using WebSockets. Do you plan to add a set value mechanism as well?