FHEM Module for Kieback Peter HRP20 Heating Controller

Begonnen von Nik, 17 Dezember 2019, 14:34:40

Vorheriges Thema - Nächstes Thema

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:
<STX>G0 0000 Terminalprog.__ 128 0 1.04 A 0.0.0 2 KPT001<CR><ETX>D270<SUB>
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:
<SYN><ACK>
and replies with:
G0 0000 Ich_bin_ein_HRP 81 1 3.67GB 0 16 1 HRP001<CR><ETX>852E<SUB>
(852E is again the checksum)

Each controller reply line has to be acknowledged by
<SYN><ACK>
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:
<STX><Command><CR><ETX><XModem check sum><SUB>
An example command to read the boiler supply temperature looks like this:
p0 16 b6
with:
16 - being the controller address, and
b6 - being the address where the mentioned temperature is stored.
The full query, accordingly:
<STX>p0 16 b6<CR><ETX>3EED<SUB>

The controller replies with:
<SYN><ACK>
<STX>p1 16 b6 55.2 108 08 00 Boiler supply<CR><ETX>9445<SUB>

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
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files

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