FHEM > English Corner

FHEM Module for Kieback Peter HRP20 Heating Controller

(1/1)

Nik:
Hi guys,

After successfully using FHEM in the past with CUL, I am considering a making a FHEM module as an interface to a Kieback Peter HRP20 heating controller. It is a small home heating automation project my son and I wanted to do (i.e. start) for fun over Christmas holidays. 

Let me shortly describe the hardware environment:
An oil powered heater (i.e. a boiler) and a mixer (for floor heating) are controlled by a Kieback & Peter HRP 20 controller. The controller has RS232 connection and the communication protocol is known to me. Using the protocol process variables can be read and controller parameters can be set. I am able to communicate with the controller using a terminal program.

The protocol:
To initiate communication, the following message is to be sent to the controller:

--- Code: ---<STX>G0 0000 Terminalprog.__ 128 0 1.04 A 0.0.0 2 KPT001<CR><ETX>D270<SUB>
--- Ende Code ---
where:
<STX>, <CR>, <ETX> etc. are representing by their ASCII byte equivalents:
"D270" is the checksum calculated using CRC-CCITT (XModem).

The controller acknowledges received line with:

--- Code: ---<SYN><ACK>
--- Ende Code ---
and replies with:

--- Code: ---G0 0000 Ich_bin_ein_HRP 81 1 3.67GB 0 16 1 HRP001<CR><ETX>852E<SUB>
--- Ende Code ---
(852E is again the checksum)

Each controller reply line has to be acknowledged by

--- Code: ---<SYN><ACK>
--- Ende Code ---
Failing to acknowledge controller reply causes the controller to repeat the last line sent, up to a total of 5 lines, after which the communication needs to be reinitialised.

The controller replies to queries sent.  Additionally, each minute, the controller sends current date & time (this needs to be acknowledged, as well, by a <SYN><ACK> pair).

The queries have the following structure:

--- Code: ---<STX><Command><CR><ETX><XModem check sum><SUB>
--- Ende Code ---
An example command to read the boiler supply temperature looks like this:

--- Code: ---p0 16 b6
--- Ende Code ---
with:
16 - being the controller address, and
b6 - being the address where the mentioned temperature is stored.
The full query, accordingly:

--- Code: ---<STX>p0 16 b6<CR><ETX>3EED<SUB>
--- Ende Code ---

The controller replies with:

--- Code: ---<SYN><ACK>
<STX>p1 16 b6 55.2 108 08 00 Boiler supply<CR><ETX>9445<SUB>
--- Ende Code ---
55.2 is the temperature (in deg C).
etc

The module would have to
1. Initialise the communication (one time)
2. Keep the communication channel alive by acknowledging each date & time information line sent by HRP20 with <SYN><ACK> (asynchronously, within 1 second from HRP sending the information line)
3. Receive and send data containing payload:
    3.a Build and send queries to the controller
    3.b Parse received replies
    3.c Attempt to reinitialise communication, should the controller fail to reply to a query
    3.d Acknowledge each reply line with <SYN><ACK>

The questions follow:
1. What would be the best way to proceed, is there a module which implements a somewhat similar protocol?
2. How to (asynchronously) acknowledge the "keep-alive" date & time messages from the HRP20?
3. Is there already a script present to compute XModem checksum?

Best regards,
Nik

Beta-User:
So first: Welcome to the FHEM forum :) .

I'm no expert in these things, but you might first have a look at the "Modbus" module; that might handle the physicical communications part. Apart from the commandref, there's also some more info on that available in https://wiki.fhem.de/wiki/Modbus (written in English).
Perhaps that helps?

Kind regards,

Beta-User

rudolfkoenig:
Another alternative is the KM271 module, which does similar things.

Nik:
Thank you, @Beta-User and @rudolfkoenig. I will take a look at Modbus and KM271 modules and report my progress.

springber:
Dear Nik,

did you make any progress in your project? I also have a HRP, due to lack of full protokol information all I do is to trigger a full transfer of all parameters every 5 min via a linux script and CRON - convert and import into FHEM.

Wishlist, trigger receiving single parameters like boiler temperature, and more set parameters..

kind regards

springber

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln