P1P2MQTT icon indicating copy to clipboard operation
P1P2MQTT copied to clipboard

Support for EKH/RKH systems - such as Rotex RKHBRD016 (Daikin Altherma EKHBRD-ADV17), strange values

Open mrrepel opened this issue 2 years ago • 45 comments

Hi,

First of all, thanks to Arnold for sending the P1P2ESP quickly, it arrived within 2 days and, looking at the construction method, I can only say that it is like an commercial product! After I received it I immediately got tinkering.

Unfortunately it seems that my heat pump is not supported. The values fluctuate on some sensors (not all) and the values are not correct.

Below is a screenshot of the HA interface.

I am not a programmer but a hobbyist. I would like to hear if and how I can help with providing logs etc. so that this heat pump can also be supported. The values I am particularly interested in are;

  • DHW temp
  • Leaving / return temp -Outside temp

Kind regards, Barry

p1p2

mrrepel avatar Dec 23 '22 20:12 mrrepel

Thanks @mrrepel for your feedback. Indeed RKH*/EKH* systems (which I think are called Altherma 2) are not as well supported as Altherma 3 systems. For now I think we would be able to modify the code such that it reports a number of sensor values (I hope at least some of the temperatures (49.000, 44.582, 33.906) are correct for your system even if the names used may be wrong). We will need to write a separate header file for the EKH systems. It would be helpful for me to receive your logs of raw data P1P2/R/# together with a description of system changes made during the log (on/off, target setings changed manually, temperature values changing as a response, so we can match these to the changes in the raw data logs).

There are a few EKH* users with the P1/P2 interface so this issue would be a good place to start sharing EKH/RKH experiences.

Arnold-n avatar Dec 23 '22 20:12 Arnold-n

Now that my holidays have started I picked it up again for my Altherma 2 (EKHVH008BB6WN). I can already report the following:

  1. Set point values are decoded correctly. However the labels are not correct. The following changes need to happen.

    • S1_DHW_Setpoint_Response -> Target temperature leaving water. There is no room thermostat in my system, so room temperature is not the correct label I think.
    • S0_Target_Temperature_Room -> Target temperature DHW Tank
  2. All measured values seem to have the wrong encoding applied. The jump up and down while on the controller itself only the value after the . seem to fluctuate. I "hacked" the NTC of my boiler with 2 relays so that I can let it measure the correct value, a very low value or a high value. I use this to make it heat only on solar in the summer. This also means that I can create an mqtt dump while the values change before the .

I have not dived deeps enough into but at the very least it seems that the byte order is different (or not fixed point at all). Often the part behind the . is stable while the part before it fluctuates a lot. The results of my experiment are as follows. The files attached are the dumps that correspond to the values the daikin controller reported. I wrote down all the values I saw:

A. 44.1 44.2 44.4 B. 31.5 31.6 C. 56.9 57

B.txt C.txt A.txt

Based on the changing values, my guess is that this sensor is labeled T1_Temperature_DHW_Tank

Once we can find the correct encoding, it should not be to difficult anymore to also correctly label all other values. They all report the same strange values.

bartv avatar Dec 24 '22 11:12 bartv

Hi @bartv - thanks very much, very useful information. I will set up a separate header file for EKH over the next week based on your findings.

The user manual for the EKHBRD-ADV17 system indicates that it supports a main controller (room thermostat) and a slave controller (2nd room thermostat, used for controlling but not really as room thermostat). If someone would have a system with 2 such controllers and make raw data logs when changing settings on the 2nd auxiliary/slave controller, we could determine whether the protocol between main controller (master) and auxiliary controller (slave) would function in the same way as on other (Altherma 3 or VRV) systems, and we would actually be able to control EKH/RKH systems too!

Arnold-n avatar Dec 24 '22 12:12 Arnold-n

Yeah, I have already started searching ebay and 2hands for something like that. No luck so far :-)

bartv avatar Dec 24 '22 12:12 bartv

My C is a bit rusty and the code is not the most accessible to make changes to so I wrote a short python script to validate my suspicion that the bytes are swapped. In the A trace I was able to get the 3 values I read on the controller like this:

data = """05084C2CD41704184818F414A9
05084C2CD417181848180C1557
05084C2CD41730183018F4140E
05084C2CEC17181830180C1530
05084C2CEC1718184818F41456
05084C2CEC17301848180C152D
0508282C0418181830180C15EC
0508282C0418301848180C15F1
0508282CD417041860180C1594
0508282CD417181830180C1512
0508282CD41718184818F41474
0508282CEC17041830180C15ED
0508282CEC17181830180C1557
0508282CEC1718184818F41431
05084C2C0418301848180C1596
05084C2CBC17181830180C1521
05084C2CD417181830180C1575
05084C2CD41718183018F41431
05084C2CD417181848180C1557
05084C2CD41718184818F41413
05084C2CD417181860180C1549
05084C2CD41730183018F4140E
05084C2CEC17181830180C1530
05084C2CEC1718183018F41474
05084C2CEC17181848180C1512
05084C2CEC1718184818F41456
05084C2CEC17301830180C150F
05084C2CEC17301848180C152D
05084C2CEC1730184818F41469
05086C2CBC17181830180C1534
05086C2CD41704184818F414BC
05086C2CD41718183018F41424
05086C2CD417181848180C1542
05086C2CEC1704184818F414F9"""

for line in data.splitlines():
    data = []
    for i in range(int(len(line) / 2)):
        data.append(int(line[2*i:2*i+2], 16))

    vars = data[2:4]
    print("{:2.1f}".format(vars[1] + vars[0] / 256))

So the value is like f8_8, except the function should be:

float FN_f8_8(uint8_t *b)            { return (((int8_t) b[0]) + (b[-1] * 1.0 / 256)); }

bartv avatar Dec 24 '22 12:12 bartv

The DHW setpoint response seems to be the "stooklijn" from the weather setpoint. This is the preset for leaving temp hot water for heating (when it is cold, the heatingwater will be warmer and vice versa, see graph). Setting 3 in the menu. I also use an external thermostat with the EKRP1AHTA interface card (dry relais), so there are no room temperature settings for me, S0_Target_Temperature_Room stays at 16 "C

Also the next sensors are correct: S0_Heating_OnOff S0_DHW_OnOff S0_Quiet_Mode S1_Defrost_Operation

Mismatches in names: T1_Temperature_Refrigerant_1 seems to be T1_Temperature_Return_Water T1_Temperature_Outside_1 seems to be T1_Temperature_DHW_Tank

Because i switch the heatpump on/off externally for heating i think these ones are correct to: S1_Circulation_Pump_OnOff S1_Compressor_OnOff

The warmtepomp on/off is a relais starting/stopping heating

Screenshot 2022-12-24 at 19-47-32 History – Home Assistant

Other values fluctuate, maybe the bitswapping as Bart stated.

mrrepel avatar Dec 24 '22 18:12 mrrepel

I did an attempt to update the firmware to already figure out the correct labels. I am unable to generate a working firmware using the arduino ide. It compiles and can uploaded (both using serial and OTA), the boards responds to a ping but it does not connect to MQTT and the telnet interface does not come up. I used my arduino ide before, even for esp* boards. I guess there must be some setting that is wrong?

image

bartv avatar Dec 25 '22 07:12 bartv

Hi @bartv, I think you have flash size set to default 1MB instead of 4MB. This value determines where the "EEPROM" (wifi/mqtt) data is stored. Even with 1MB selected, the WiFiManager AP "P1P2MQTT" should restart to allow entering your wifi/mqtt settings. If you change the configuration to 4MB, I think you will get the original settings back. Please let me know if that does not help - ultimate fall-back is programming with the USB programmer and "Erase Flash: All".

Also there are some changes needed to the BSP and libraries. The ESP_Telnet library owner implemented my suggestion for making the library working with ethernet differently than I did, so for the current ESP code you still need my modified version of the library, or #undefine ETHERNET, or change the code. I will update the code to allow the use of the official library now it is updated.

Arnold-n avatar Dec 25 '22 09:12 Arnold-n

That did the trick. I patched the f8_8 function to swap the bytes and now I get all stable readings image

bartv avatar Dec 25 '22 09:12 bartv

Great, many thanks! I'll incorporate this change and the name corrections into the new header file for EKH/RKH systems, or if you prefer, feel free to do so yourself.

Arnold-n avatar Dec 25 '22 09:12 Arnold-n

I created a draft PR with my findings and experiments: https://github.com/Arnold-n/P1P2Serial/pull/46

@mrrepel if you want I can also post a firmware image

bartv avatar Dec 25 '22 11:12 bartv

Thanks - I would suggest to use #ifdef EKH constructs to keep the original functionality maintained for Altherma 3, or to create a separate header file for EKH.

Arnold-n avatar Dec 25 '22 11:12 Arnold-n

That is why I created the PR. I am not sure on how much is shared between E* and EKH*. So first I am going to make the change in the E header and then decide on how to support both.

bartv avatar Dec 25 '22 12:12 bartv

@bartv , that would be really nice if you post the image.

Some logs from my system are added. If there is any need for specific logs / actions, please tell. log1.txt

mrrepel avatar Dec 25 '22 13:12 mrrepel

I can confirm that the outside temperature is correct.

bartv avatar Dec 25 '22 13:12 bartv

@bartv , that would be really nice if you post the image.

Some logs from my system are added. If there is any need for specific logs / actions, please tell. log1.txt

P1P2-bridge-change.ino.generic.zip

bartv avatar Dec 25 '22 20:12 bartv

@bartv , that would be really nice if you post the image. Some logs from my system are added. If there is any need for specific logs / actions, please tell. log1.txt

P1P2-bridge-change.ino.generic.zip

You might need to remove the integration from HA and let it discover again so that the renamed values are gone.

bartv avatar Dec 25 '22 20:12 bartv

I was able to figure out some more fields. Others are still work in progress. I create another repo with my scripts and current documentation: https://github.com/bartv/p1p2decoder/blob/main/ekh.py

The summary: https://github.com/bartv/p1p2decoder/blob/main/ekh.md

bartv avatar Dec 26 '22 13:12 bartv

Thanx Bart for sharing the firmware. Just finished flashing the ESP and after some trial and error i got the interface working again (fully my fault :-)).

The values and labels have changed, some readings work, others dont.

Label Arnold Bart
S0 DHW on/off ok ok
S0DHW setpoint response not sure fault, stays at 16'C
S0 heating on/off ok ok
S0 Quit mode ok ok
S1 circulation pump ok to be tested (seems ok)
S1 compressor on/off ok to be tested (seems ok)
S1 defrost operation ok ok
S1 target temp leaving water NA ok
T1 temperature DHW tank fault (+120/-120'C) fault (0,2/0,8'C)
T1 Temperature_HP2Gas_Water NA fault (5/-80'C)
T1 leaving water fault (near 0'C) ok (resolution 1 degree)
T1 temp outside label fault, must be T1_Temperature_DHW_Tank fault, stays at 0'C
T1 temp refrigirant 1 label fault, must be T1_Temperature_Return_Water fault, (+120/-120'C)
T1 temp return water fault (near 0'C) label fault, must be T1_Temperature_Outside
mqtt: valve 3 way   equal to S0 DHW on/off

For my heatpump a combination of both could do the trick:

Label Function
S0 DHW on/off Arnold/bart S0 DHW on/off
S0DHW setpoint response Arnold S0 DHW setpont response
S0 heating on/off Arnold/bart S0 heating on/off
S0 Quit mode Arnold/bart S0 Quit/mode
S1 circulation pump Arnold/bart S1 circulation/pump
S1 compressor on/off Arnold/bart S1 compressor on/off
S1 defrost operation Arnold/bart S1 defrost/operation
S1 target temp leaving water Bart S1 target temp leaving water
T1 temperature DHW tank Arnold T1 temp outside
T1 leaving water Bart T1 leaving/water
T1 temp outside Bart T1 temp return water
T1 temp return water Arnold T1 temp refrigirant 1
My programming skills are the same as my French....bonjour, croissant and thats it. So i am sorry my help is limited. If it is possible to make an combination of both, you would be my heroes! :-)

Greetings,

Barry

mrrepel avatar Dec 26 '22 20:12 mrrepel

Hi everybody. I'm using Arnold's interface with my EKHBRD011ADV17, and found the same results of the first part of this thread. I'll try to read the rest and report back.

For what is worth, my installation includes a RTD-W interface, which is connected to the P1/P2 inetrface and provides ModBus connection. I can manage some options and read and write (some) values with the ModBus connection, but not all of them.

If anybody wants me to test something, just tell me.

Thanks everybody for your work and regards.

Angel

aluisperezh avatar Jan 03 '23 02:01 aluisperezh

That would be really cool. It would be interesting if you can create two dumps:

  1. a longer dump that just records what is going on when you are not making change. Mainly to see if and how there is interaction between the RTD-W and the main controller.
  2. a short dump where you change setting through modbus

I create the dumps like this (replace with your mqtt server):

mosquitto_sub --host 192.168.32.23 -v -t "P1P2/R/040" > dump.txt

bartv avatar Jan 03 '23 08:01 bartv

@aluisperezh indeed as @bartv mentions: logs are useful both making no changes, when making changes on the main controller, and when making changes with the RTD-W.

Perhaps it is interesting to do a full log also when the system restarts, to determine if there is any particular extra communication with the RTD-W which is only there during/shortly after a system restart.

Arnold-n avatar Jan 03 '23 08:01 Arnold-n

I'm recording the "standard working" logs right now, but there are not many lines written: only one ("P1P2/R/078 R T 0.003: 40F0344B") in the last few minutes. Should I enable some verbose option or anything like that? I'll leave it recording all night and tomorrow I'll record some more changing things through RTD-W. Restarting the whole machine (I understand that that's what you mean, Arnold) is a little bit more difficult, but I'll try.

Regards

Angel

aluisperezh avatar Jan 03 '23 23:01 aluisperezh

Must be doing something wrong. No other lines in the output file but the one I saw yesterday...

aluisperezh avatar Jan 04 '23 10:01 aluisperezh

Must be doing something wrong. No other lines in the output file but the one I saw yesterday...

What command do you use to subscribe to the mqtt stream?

bartv avatar Jan 04 '23 10:01 bartv

This is what I'm using:

nohup mosquitto_sub --host 192.168.98.11 -u myuser -P mypassword -v -t "P1P2/R/078" > dump_standard_working.txt &

With mqtt Explorer I can't see any more messages. And I assumed that your 040 should be my 078 (final byte of IP address).

Regards

aluisperezh avatar Jan 04 '23 11:01 aluisperezh

I do not think so. You need the P1P2/R/... messages. So try this topic with a wildcard in it: "P1P2/R/#"

bartv avatar Jan 04 '23 11:01 bartv

There is nothing else there: image

And I can see that the device is connected through telnet: image

Edit: The wildcard produces the same results :(

aluisperezh avatar Jan 04 '23 11:01 aluisperezh

I restarted the Altherma machine. I won't be able to do it when I'm back home tonight, so I did it now. There are no other lines besides the one I sent yesterday, but the telnet session gives some more info. I have attached what I could see there.

My P1P2 device is powered by the P1P2 interface, so everything is restarted. I mean, no commands provided through telnet or any other way.

I can connect trhough telnet or to the MQTT server from home, so I can do some tests later.

Regards Angel Conexión Telnet.txt

aluisperezh avatar Jan 05 '23 12:01 aluisperezh

Hi @aluisperezh , thanks and interesting. [edit: the settings above only show messages with errors, not the real data, which is below in the compressed ZIP file.]

MQTT explorer cannot easily log all the P1P2/R/# data, but in telnet you will see all raw hex data by entering the command j13013 Could you try that?

Arnold-n avatar Jan 05 '23 16:01 Arnold-n