KM200 - Parsingexception in JSON . OFFLINE - COMMUNICATION_ERROR

Hi there,

i am trying to add a KM200 (Buderus interface) to openhab. But the logfile says:
[b.binding.km200.internal.KM200Device] - Parsingexception in JSON: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 4 path $ service: /gateway/DateTime

This is a brand new openhab installation, up to date.
binding-km200 - 2.5.10.
Other bindings: only Astro.

KM200 thing stays OFFLINE - COMMUNICATION_ERROR

Any clues?

Hello,
please set you binding to DEBUG and post the output of the log showing the JSON result you receive from your heating using code fences.
@Markinus may be able to give advice or correct the binding, he is the binding maintainer.
Regards
Thomas

Hello,

how do i set the KM200 binding to DEBUG?

Tried it by openhab> log:set DEBUG
but neither of that is working:
org.openhab.binding-km200
org.openhab.binding.binding-km200
org.openhab.binding.km200.internal.KM200Binding

How do i get the correct name of the binding?

Regards
Joe

log:set DEBUG org.openhab.binding.km200

hi,
it looks like problems with the encryption. Check the keys/password and the Java Cryptography Extension.

Hello all,

i worked it out:

Since you mentioned encryption/keys/password i tried it with the app, but it also didn’t worked anymore. I reinstalled, scanned the code, but nope. So i did a factory reset on this totally overpriced poor piece of hardware, connected the app and it worked. Then generating the key on the website and now its working in openhab again. Hurray!

Maybe a firmware update gone wrong? I locked now its internet access…

Thanks to all for your fast help!

Regards
Joe

Hello, today I ran into the same issue and I am looking for some advice. What am I doing wrong here? Should I be able to access the restful web service from the browser as well? I tried “http://192.168.243.xy/gateway/DateTime” but only got a page with “Sorry, the requested file does not exist on this server.”

Thanks
Thomas

10:41:29.858 [DEBUG] [ng.km200.internal.KM200HandlerFactory] - It’s a gataway: km200:kmdevice
10:41:29.863 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler KM200GatewayHandler tried updating the thing status although the handler was already disposed.
10:41:29.876 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing ‘km200:kmdevice:999999999’ changed from UNINITIALIZED (DISABLED) to INITIALIZING
10:41:29.889 [INFO ] [.internal.handler.KM200GatewayHandler] - Update KM50/100/200 gateway configuration, it takes a minute…
10:41:29.893 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set read delay to: 100 seconds.
10:41:29.896 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set refresh interval to: 30 seconds.
10:41:29.899 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set max. number of repeats to: 10 seconds.
10:41:29.901 [DEBUG] [nhab.binding.km200.internal.KM200Comm] - Starting receive connection…
10:41:30.034 [WARN ] [ab.binding.km200.internal.KM200Device] - Parsingexception in JSON: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 5 path $ service: /gateway/DateTime
10:41:30.040 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing ‘km200:kmdevice:999999999’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): No communication possible with gateway

Hi, I’m having the same problem:

11:32:02.547 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'km200:kmdevice:XXXXXXXXX' changed from OFFLINE to UNINITIALIZED (DISABLED)
11:32:05.727 [DEBUG] [ng.km200.internal.KM200HandlerFactory] - It's a gataway: km200:kmdevice
11:32:05.734 [WARN ] [b.core.thing.binding.BaseThingHandler] - Handler KM200GatewayHandler tried updating the thing status although the handler was already disposed.
11:32:05.757 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'km200:kmdevice:XXXXXXXXX' changed from UNINITIALIZED (DISABLED) to INITIALIZING
11:32:05.771 [INFO ] [.internal.handler.KM200GatewayHandler] - Update KM50/100/200 gateway configuration, it takes a minute....
11:32:05.783 [TRACE] [.internal.handler.KM200GatewayHandler] - initialize Key: privateKey Value: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
11:32:05.793 [TRACE] [.internal.handler.KM200GatewayHandler] - initialize Key: readDelay Value: 100
11:32:05.802 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set read delay to: 100 seconds.
11:32:05.814 [TRACE] [.internal.handler.KM200GatewayHandler] - initialize Key: refreshInterval Value: 30
11:32:05.819 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set refresh interval to: 30 seconds.
11:32:05.828 [TRACE] [.internal.handler.KM200GatewayHandler] - initialize Key: maxNbrRepeats Value: 10
11:32:05.838 [DEBUG] [.internal.handler.KM200GatewayHandler] - Set max. number of repeats to: 10 seconds.
11:32:05.844 [TRACE] [.internal.handler.KM200GatewayHandler] - initialize Key: ip4Address Value: 10.10.12.170
11:32:05.888 [DEBUG] [nhab.binding.km200.internal.KM200Comm] - Starting receive connection...
11:32:06.023 [WARN ] [ab.binding.km200.internal.KM200Device] - Parsingexception in JSON: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 19 path $ service: /gateway/DateTime
11:32:06.037 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'km200:kmdevice:XXXXXXXXX' changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): No communication possible with gateway

Key length is also sufficient:

Max AES key length = 2147483647

I’m logged into the HomeCom app with the same credentials I used to create the private key. I don’t know what could be wrong.

Brand: Junkers
Network adapter: MB LANi
Firmware: 04.08.02

Thanks for help!

Hello together,

I’m dealing with the same problem since months (but it took a long time before I’ve got some spare time to scrutinize the KM200 vs. the binding).

1st of all, I’ve been able to verify the AES private key by using the PHP scripts provided by Andreas. With help of a slightly modified script, the verification of the AES key calculation succeeded: The password is correct and the gateway is responding.

2nd step was to enter this AES private key into the binding configuration (tried both ways either via PaperUI or via textual configuration) resulting in the same error messages … therefere, the bindung seems to do same strange things.

3rd with help of a network sniffer, I’ve been observing the request URLs from bindung to KM200:
Most of them are answered with valid JSON (after decryption), but the registration query leads to weired results:

contacting MB-LAN for /gateway/DateTime
>>>{"id":"/gateway/DateTime","type":"stringValue","writeable":1,"recordable":0,"value":"2022-08-10T16:31:02"}
DateTime is 2022-08-10T16:31:02:

contacting MB-LAN for /gateway/uuid
>>>{"id":"/gateway/uuid","type":"stringValue","writeable":0,"recordable":0,"value":"207060676"}
uuid is 207060676:

contacting MB-LAN for /gateway/versionFirmware
>>>{"id":"/gateway/versionFirmware","type":"stringValue","writeable":0,"recordable":0,"value":"01.10.03"}
versionFirmware is 01.10.03:

contacting MB-LAN for /gateway/userpassword
userpassword is :

contacting MB-LAN for /gateway/instPassword
instPassword is :

contacting MB-LAN for /gateway/instAccess
>>>{"id":"/gateway/instAccess","type":"stringValue","writeable":1,"recordable":0,"value":"off","allowedValues":["on","off"]}
instAccess is off:

contacting MB-LAN for /gateway/instWriteAccess
>>>{"id":"/gateway/instWriteAccess","type":"stringValue","writeable":1,"recordable":0,"value":"off","allowedValues":["on","off"]}
instWriteAccess is off:

contacting MB-LAN for /gateway/registrations
>>>'??b?ȝ˓Wdul
registrations is :

The recent communication is leading to the initialization failure.

Hi all!

I’m new to this forum and I’m hoping to get help here.

I recently setup openHab3.3 on a rpi3 with with Raspberry PI OS bullseye. Now I tried to get KM200 binding running but received always:

2022-08-21 11:30:44.786 [INFO ] [internal.handler.KM200GatewayHandler] - Update KM50/100/200 gateway configuration, it takes a minute....
2022-08-21 11:30:44.789 [DEBUG] [internal.handler.KM200GatewayHandler] - Set read delay to: 100 seconds.
2022-08-21 11:30:44.793 [DEBUG] [internal.handler.KM200GatewayHandler] - Set refresh interval to: 30 seconds.
2022-08-21 11:30:44.797 [DEBUG] [internal.handler.KM200GatewayHandler] - Set max. number of repeats to: 10 seconds.
2022-08-21 11:30:44.800 [DEBUG] [hab.binding.km200.internal.KM200Comm] - Starting receive connection...
2022-08-21 11:30:44.953 [WARN ] [b.binding.km200.internal.KM200Device] - Parsingexception in JSON: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 2 path $ service: /gateway/DateTime

I created the private key as descriped before with key generator from Andreas Hahn. Device password and user password are correct and I’m able to connect KM200 modul with MyBuderus app.

Now I have no idea how to fix this communication problem between openhab KM200 binding and my Buderus heating modul.

Any hint is very much appreciated!

Regards
Andreas

Hello @steini76,

there seems to be a race condition within the parallel initialization requests:

  • In my case, after several disable/enable request via the PaperUI, the binding went online (even when the erroneous respond message regarding the query /gateway/registrations is still visible on the wire).

Hi @gs4711,

I enabled/disabled more than 20 times in a row but did not work. :frowning:

Any further hint is very much appreciated!

Regards

Hi everybody!

I’m still not able to use the KM200 binding. I think my problem is the private key I generated on this page from Andreas Hahn.

How can I generated a valid private key?

Kind regards
Andreas

Assuming that you have access to a docker environment, please try the script of this repository
https://gitlab.smile.de/Group-SMILE/de.smile.tools.junkers-km200
by i.e.

git clone git@gitlab.smile.de:Group-SMILE/de.smile.tools.junkers-km200.git
cd de.smile.tools.junkers-km200
docker build -t km200 .
docker run -ti -e KM200_GATEWAY_PASSWORD=AGUSwsLzcpZWRMHG -e KM200_PRIVATE_PASSWORD=secretOne -e KM200_GATEWAY_HOST=192.168.1.1 km200 php 

which will print the private key like

private key
string(64) "ee0eaba1139beb8109318ed3625e13e2e9e3d3eaac900a20d40e97c0a980bff5"

This is what I got:

========================================
contacting MB-LAN for /gateway/DateTime
>>>�s�♣�l��Kb��Kgٝ��
�♦�ϥb?5��Z����3↕B�f�@��זeq�ںmm9���▬�☺l�x~       f☺�V☻ϦB→���Yc'�Q�c�▬��9☻♣/Y↔VO►���♫i�G▲c��#��V
DateTime is :

contacting MB-LAN for /gateway/uuid
>>>�s�♣�l��Kb��Kgٝ�A��^�Vu���Q0��↔��ͅ��k⌂#�����u��-3��z�O)��►|�$�/�y'�5����������O)�♦►��L=�v♫���}�_↓▼��t�8�\����q▲ze#◄�Z�`Eb>z�L/
uuid is :

contacting MB-LAN for /gateway/versionFirmware
>>>�s�♣�l��Kb��KgٝGP'��B��ρ�♂X►����"�\TJ�����§ ↑,6�d.��        �o4�▼?ؚ�]~��X]�`P��F�œ|^V‼�♠∟i�M♠♥&��H▼�B���x��8��
versionFirmware is :

contacting MB-LAN for /gateway/userpassword
userpassword is :

contacting MB-LAN for /gateway/instPassword
instPassword is :

contacting MB-LAN for /gateway/instAccess
>>>�s�♣�l��Kb��Kgٝ���i-��s      0�4a,�/�8'♀�.0U�]+Lz�W0�iC-*�G\�♀�A�§�$qm�Υ����9���vg2▬F+�►♫��2�∟�ér�˜'i↨ŝ<��%܂GH%���¥f��Y���
instAccess is :

contacting MB-LAN for /gateway/instWriteAccess
>>>�s�♣�l��Kb��Kgٝ�����15♂�Ґ�qBB�����"�\TJ�����§       ↑,6�d.��        �o4��X�♂$�:�\7�q�L↨↓�Q���l�\'��ġ��6(��∟��F_�er�>w�S��q�!x�ߗU����
instWriteAccess is :

contacting MB-LAN for /gateway/registrations
registrations is :

contacting MB-LAN for /system/sensors/temperatures/outdoor_t1
>>>O��♥�¶,3�R♂�r�)♠���>�-���<♫�Dǻ�►s��nF↑↓�]�A�������x�☻�@4�`�H�
q�
�Z�Äo��r����↕d↓m���{�V�♠�çL|&��f�♦}☼;���        .���☺o��hxq�9+◄���☺g��-Q♂��↑▬����N�X♣��C�Ql▼4O\↓��uz:6����`�
outdoor_t1 is :
NULL
done

Any ideas?

Regards

Of course, that points to a bad combination of passwords: either the device password (which is printed onto the KM200 with hyphens in between) or the user password seems to be wrong.

The further output is the decrypted answer which should be human readable JSON like

contacting MB-LAN for /gateway/DateTime
>>>{"id":"/gateway/DateTime","type":"stringValue","writeable":1,"recordable":0,"value":"2022-09-15T22:24:24"}
DateTime is 2022-09-15T22:24:24:

contacting MB-LAN for /gateway/uuid
>>>{"id":"/gateway/uuid","type":"stringValue","writeable":0,"recordable":0,"value":"207060676"}
uuid is 207060676:

contacting MB-LAN for /gateway/versionFirmware
>>>{"id":"/gateway/versionFirmware","type":"stringValue","writeable":0,"recordable":0,"value":"01.10.03"}
versionFirmware is 01.10.03:


That was my assumption too, but why does the communication with the Buderus app work?

Regards

I double checked my credentials. Everything is correct!

Regards

Perhaps a change of the user password could help: Try to avoid any special characters. An easy to be guessed secret won’t hurt.

Hi all!

I could solve my problem!

  1. In MyBuderus app I removed my asset which was connected to KM200 modul and logged out of MyBuderus app.

  2. Then I did a reset on my KM200 modul and started MyBuderus app again.

  3. The app found my asset and asked my to set a password for a secure connection.
    And that was the point! I always thought I have to use the password from my BoschId the same I use to login to my app. :man_facepalming:

I didn’t remember that I set a second password (the so called “salt”) as I added my asset to my app.

Special thanks to @gs4711 who give me the crucial hint

Regards
Andreas

1 Like