I’ve found some pointers in this forum on how to read and write values to my Daikin Altherma air/water heat pump via the BRP069A61 LAN-adapters websocket interface but now I’m a bit confused how to properly get the consumption values to a sensor that can be used in hte new “Energy” feature.
The websocket response for the consumption is reported per 2-hour period (yesterday + today), per day (last week and this week) and per month (this year and last year).
The consumption is reported as three lists, where the 2-hour periods are reported as [“Yesterday 00:00 - 01:59”, “Yesterday 02:00 - 03:59”, …, “Yesterday 22:00 - 35:59”, “Today 00:00 - 01:59”, …, “Today 22:00 - 23:59”]. The same way for per-day (starting with last week’s Monday, ending with this week’s Sunday) and per-month (starting with last year’s January and ending with this year’s December.)
The ongoing period is incremented as time passes and the periods that have not been started yet are reported as “null”. Below is the relevant part of the response when reading the consumption for the water tank with the following lines of code (which I have found elsewhere on this forum).
from websocket import create_connection
import json, datetime, time, urllib
ws = create_connection("ws://IP-OF-MY-LAN-ADAPTER/mca")
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/2/Consumption/la\",\"fr\":\"/TarmoTest\",\"rqi\":\"xijub\"}}")
print(json.loads(ws.recv()))
{"Electrical":
{
"Heating":
{
"D":[0,0,1,0,0,0,0,0,1,0,0,1,0,2,0,0,0,0,null,null,null,null,null,null],
"W":[2,4,4,2,3,3,2,3,2,null,null,null,null,null],
"M":[null,null,null,null,null,null,null,null,null,null,2,109,140,110,119,114,96,83,75,27,null,null,null,null]
}
}
}
I’m thinking that I might have a script running on some computer and send the consumption values over MQTT since I’m already communicating other things to MQTT sensors in Home Assistant, but what would a proper way of getting the consumption to a sensor that can be used by “Energy”? I can send the ongoing periods (i.e. the last non-null value in the lists) and use that, but then I wouldn’t get any history… I’m not getting any cumulative consumption value.
Also, the values in the lists are rounded/truncated so the sum of the 2-hour periods for a day will not add up to the consumption for that day. The sae with days → month consumption.
If I knew how to make a custom integration I would not need MQTT obviously, but I don’t…
The full websockets response also inlcudes the following strings which seem to identify the current date and the periods: “12” = 12:00-13:59, the “2” at the end seems to be the day of the week (2 = Tuesday).
‘ct’: ‘20210810T120002Z’, ‘lt’: ‘20210810T120002Z’