Page 1 of 1

Understanding OTGW messages

Posted: Mon Aug 20, 2018 10:09 am
by matthew73210
Hello all,

I'm new to the forum but have been using an OTWG from nodoshop for over a year. And it all works perfectly.

Lately, I've been trying to understand how the OTGW communicates with the monitor program. If I telnet into the otgw I can see the same payload as what appears in the monitor program (log). I can kinda understand how the messages are coded.
It seems to be hex and the last 4 digits, but you have to make sure if it's a floating hex or int. The webpage about the otgw is well written but lacks examples on how to decode this data.

Example :

Code: Select all

09:11:41.249452	R807A0000	Read-Data 	DHW pump/valve operation hours: 0
09:11:41.345618	B407A1B44	Read-Ack  	DHW pump/valve operation hours: 6980
80 or 40 Not sure what this reperesents ?
7A base 16 --> 122 base 10 --> DHW pump/valve operation hours (MsgID=122)
1B44 base 16 --> 6980 base 10

And

Code: Select all

09:11:48.534414	R80190000	Read-Data 	Boiler water temperature: 0.00
09:11:48.627821	B40192733	Read-Ack  	Boiler water temperature: 39.20
Again 80 or 40 ?
19 base 16 --> 25 base 10 --> Boiler water temperature (MsgID=25) - Printed as a floating point value
27.33 base 16 --> 39.19921875 base 10 --> 39.20

In the example :

Code: Select all

09:11:44.379532	R801C0000	Read-Data 	Return water temperature: 0.00
09:11:44.516667	BC01C2666	Read-Ack  	Return water temperature: 38.40
What does C0 represent? That the clock is set for MHz or that comfort mode is engaged?
I understand what R and B mean, I can also change the setpoint with the "CS=xx" with xx being an int value.

Am I missing something?

The plan is to decode these values in python and create my own control loop using a Smith predictor and feedback loop to create a robust (possible H_inf or even H_2) control loop. Part of my degree is control theory so this is a part-time hobby which I enjoy.

Again thanks for any help !

Matthew

Re: Understanding OTGW messages

Posted: Mon Aug 20, 2018 4:36 pm
by hvxl
As indicated on http://otgw.tclcode.com/firmware.html#operation, the 8 hexadecimal digits represent the four data bytes of the message. The meaning of the opentherm messages are described in the OpenTherm protocol PDF document (see viewtopic.php?f=70&t=2046). Specifically look at chapter 4.2 Frame Format.

The byte you seem to have trouble with contains the message type and a parity bit. So: 80 is Read-Data with the parity bit set. 40 is Read-Ack with the parity bit cleared. C0 is Read-Ack with the parity bit set.

Re: Understanding OTGW messages

Posted: Mon Aug 27, 2018 6:32 pm
by marcelr
@matthew73210

Nice plan. I wrote the entire coding/decoding part for the OT protocol some time ago in C, as part of a boiler emulator, in combination with Schelte's OTGW. It only misses a controller :-). Shouldn't be too hard to port to python (or even link it as a library against python code).
You can find it here:
viewtopic.php?f=75&t=11482&p=81104&hili ... tor#p81104

Re: Understanding OTGW messages

Posted: Sat Sep 01, 2018 11:52 am
by matthew73210
Hey,

Thanks for you help, I fully understand it now ! And cheers for the plan.

I think it may be easier to use the PS=1 command and decode from there. But I may have found a slight glitch; on my controller at least.

If I set a setpoint using the CS command the value comes up :
11:30:31.409853 R90013200 Write-Data Control setpoint: 50.00
11:30:31.569905 B50013200 Write-Ack Control setpoint: 50.00
But with the PS=1 command it doesn't show :
11:30:31.786744 Command: PS=1
11:30:31.926119 PS: 1
11:30:32.036680 00000001/00001010,0.00,00000011/00000011,0.00,0/0,0.00,20.00,0.00,0.00,31.95,0.00,0.00,21.70,40/40,65/20,40.00,65.00,9032,9928,3024,7832,544,910,7268,84
According to the site, it should be the 2nd payload, which in my case prints "0.00". All the other payloads match up with what otmonitor decodes in the "PS=0".

Perhaps I am missing something yet again, alas.

Cheers,

Matthew

Re: Understanding OTGW messages

Posted: Sat Sep 01, 2018 8:59 pm
by hvxl
Not a glitch. The PS output reports the data the OTGW receives, not what it sends. It looks at Write-Data messages from the thermostat and Read-Ack messages from the boiler. This means that the two messages you showed are irrelevant for the PS data. You will almost certainly also have T10010000 messages, which is why the PS output shows 0.00 for the control setpoint.

Re: Understanding OTGW messages

Posted: Sun Sep 02, 2018 11:38 am
by matthew73210
Hello,

Thanks for your rapid reply, I don't use the OTGW as a middleman. Only to command the boiler directly. Bit of a bummer though, because the info comes up the other way. Such is life.

Cheers,

Matthew

Re: Understanding OTGW messages

Posted: Sun Sep 02, 2018 12:20 pm
by hvxl
Anyway, you know which control setpoint the OTGW sends, because you instructed it via the CS command. Just use that value, rather than taking the value from the PS output.

And if all else fails, you can always modify the firmware to do what you want.