Binding Request : Buderus web gateway

Updated.

Hi,

I am on openhab 2.5.2 and I cannot seem to get the km200 binding to work.
The private key should be correct. I generated it myself and compared it to the one generated via the link you find on the net, they are the same.

Yet I get this error when starting up:

An error occurred while calling method 'ThingHandler.dispose()' on 'org.openhab.binding.km200.internal.handler.KM200GatewayHandler@59b3cc': hexString needs to have an even length:
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  java.lang.IllegalArgumentException: hexString needs to have an even length:
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:105) ~[bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:119) ~[bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.openhab.binding.km200.internal.KM200Device.setCryptKeyPriv(KM200Device.java:151) ~[?:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.dispose(KM200GatewayHandler.java:145) ~[?:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  14:15:30.368 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while disposing handler of thing 'km200:kmdevice:home': hexString needs to have an even length:
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  java.lang.IllegalArgumentException: hexString needs to have an even length:
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:105) ~[bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:119) ~[bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.openhab.binding.km200.internal.KM200Device.setCryptKeyPriv(KM200Device.java:151) ~[?:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.dispose(KM200GatewayHandler.java:145) ~[?:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
2020-03-22T14:15:30+01:00 homectrl karaf[11122]:  #011at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]

The key is 64 char long.

Any Idea how I can further debug this or what the problem might be?

Looking at the function this error was raised it seems it expects a “-” delimited key, though that doesn’t work either.

An error occurred while calling method 'ThingHandler.dispose()' on 'org.openhab.binding.km200.internal.handler.KM200GatewayHandler@59b3cc': hexString needs to have an even length:

It looks like the key is not 64 characters long - otherwise it had an even length. Yours must be 63, 65 or another uneven number. Use BBEdit or anything else to count the characters. Hope my interpretation is correct.

Unfortuantely as I noted the key is 64 chars long.

I fixed my problem… I was acutally missing the JCE part of zulu jre … unbelievable one still has to install that manually -_-

This is a guide on how to install JCE for Zulu JRE: openHABian hassle-free openHAB Setup

Thanks I did that and it works fine now :slight_smile:

Hi,
I have a problem with the km200 binding that has been working really well for the last 8 months but after I updated to 2.5.3 release build it stopped working. I use it with the Junkers version of the box but as it has worked before it should work now as well :wink:

I have my openhab running on a Qnap system within a docker container. Within PaperUI I get the error “UNINITIALIZED - HANDLER_INITIALIZING_ERROR” for the Gateway thing.

Within the logs I get this error and I really do not know what else I can do to make it work again: 16:54:43.191 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.km200.internal.handler.KM200GatewayHandler@185638f0’: null

java.lang.NullPointerException: null

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.checkConfiguration(KM200GatewayHandler.java:240) ~[?:?]

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.initialize(KM200GatewayHandler.java:114) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

16:54:43.196 [ERROR] [.core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing ‘km200:kmdevice:617200032’: null

java.lang.NullPointerException: null

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.checkConfiguration(KM200GatewayHandler.java:240) ~[?:?]

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.initialize(KM200GatewayHandler.java:114) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

Does anybody have a suggestion ?

Hello @Markinus,

small suggestion from my side: It would be beneficial if we had a sticky post at the beginning of the thread showing

  • Latest Version of the Binding (Date + Download link)
  • Version contained in the current OH-Release (e.g. 2.5.3: All fixes until …)

Currently I´m not certain if 2.5.3 contains the fixes from November or if it is even more advanced.
From what I see in the log the fix for the decimal digits has not been included in 2.5.3 yet.

This would make live much easier when deciding to e.g. remove the “Bugfix-Version” from the AddOns folder and go for “standard” again.

Kind Regards and stay healthy
Oggerschummer

Hi,

for those struggling with the invalid hex string length let me provide the steps I took to resolve it.

Inititial situation:
I had a snapshot version of the binding installed in the add-ons folder of OH 2.5.x. (The last one mentioned in the thread above)

After upgrading to 2.5.2 and 2.5.3 many channels did not appear anymore.
So I decided to drop the snapshot version and go for the one included in 2.5.3.

Deleting the snapshot file did not help, as after activating the 2.5.3 version in the PaperUI the infamous “even-lenght-error” occured.

In the end I came up with this solution:

  • Delete the km200 things (ensure to delete the bridge as the last one, otherwise the depending things are a bit harder to uninstall
  • Delete any KM200-related items in the PaperUI (Boooooring…)
  • Deactive the Binding in PaperUI
  • Stop the openHAB service
  • Delete the snapshot version in the addons-folder if present.
  • Run sudo openhab-cli clean-cache from console to clear the cache.
  • Restart openHAB
  • Active the Binding in PaperUI
  • Let it discover the Gateway thing
  • Configure the gateway by pasting the key string from an Editor (e.g. BBEdit) into the file and save it.
  • Get yourself a tea, it takes some time for the binding to connect and to discover the available services
  • Check your inbox and happily accept the things you want to use (I started with a single “temperatures” thing to keep it simple)
  • Activate the things channel that are of use for you.

Most important I guess is to drop any remaining entries / files from previous version and to clear the cache.

Hope this helps, it reproducibly did the trick for me.

Stay healthy
Oggerschummer

Hi,
I haven’t changed anything on this binding. The last precision fix is not merged yet.
For me the binding works perfectly after the update to 2.5.3. One thing what I am always doing after a upgrade is to stop openhab and clean the cache ( sudo openhab-cli clean-cache) and reboot the device. This is fixing many problems automaticaly on upgrade.
Greetings
Markus

@Markinus, @Oggerschummer, @Truercki,

I had the same problem but I found the issue … In my case I was not using the right cryptography level. I am running the docker container version of OpenHAB and you can set a runtime variable for the security which can be “limited” or “unlimited” to support higher encryption. And in the previous container I had the variable set but forgot to set it in the new container again. Once I corrected that it works now like expected :slight_smile:

Hello,
think I have found a way to reproduce a situation where the key-length error shows up:
When you have a running installation (mine now worked for one day without trouble),
go to Paper UI, edit the gateway and set the auto refresh intervall from 30 seconds to 60 seconds.
As soon as you save it a HTTP 500 Internal server error shows up. In the log it complains about the invalid key lenght (even if is was working flawlessly just seconds before.)

2020-04-07 16:47:42.997 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at ‘things/km200:kmdevice:817210159/config’
java.lang.IllegalArgumentException: hexString needs to have an even length:
at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:105) ~[?:?]

at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:119) ~[?:?]

at org.openhab.binding.km200.internal.KM200Device.setCryptKeyPriv(KM200Device.java:151) ~[?:?]

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.dispose(KM200GatewayHandler.java:145) ~[?:?]

at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.handleConfigurationUpdate(BaseThingHandler.java:104) ~[?:?]

at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:93) ~[?:?]

at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:438) [bundleFile:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]

The binding did not recover from this without a restart.
After I restart OH the binding is running again, but did not save the auto refresh rate (stayed at 30).
Trying it again results in the same crash.
Maybe this gives a hint where there might be a bug - maybe the handling of the parameter data (read/write) of the gateway thing has an issue.

Greetings
Oggerschummer

@Markinus @Oggerschummer

thank you very much for all the feedback, I finally got some time to look at all the things and tried them myself. After getting rid of all the installation, bindings, clearing cache and tmp, restarting all an re-installing I always end up at the same point in the logs again (and I have been drinking lots of tea and coffee to wait for it to connect :wink: ):

12:47:02.197 [INFO ] [smarthome.event.InboxRemovedEvent ] - Discovery Result with UID ‘km200:kmdevice:617200032’ has been removed.

12:47:02.202 [WARN ] [e.core.thing.binding.BaseThingHandler] - Handler KM200GatewayHandler tried updating the thing status although the handler was already disposed.

12:47:02.224 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘km200:kmdevice:617200032’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)

12:47:09.429 [INFO ] [org.quartz.core.QuartzScheduler ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.

12:47:18.730 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing ‘km200:kmdevice:617200032’ has been updated.

12:47:18.733 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘km200:kmdevice:617200032’ changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to INITIALIZING

12:47:19.935 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.km200.internal.handler.KM200GatewayHandler@67f0767c’: null

java.lang.NullPointerException: null

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.checkConfiguration(KM200GatewayHandler.java:240) ~[?:?]

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.initialize(KM200GatewayHandler.java:114) ~[?:?]

at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

12:47:19.945 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘km200:kmdevice:617200032’ changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)

12:47:19.947 [ERROR] [.core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing ‘km200:kmdevice:617200032’: null

java.lang.NullPointerException: null

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.checkConfiguration(KM200GatewayHandler.java:240) ~[?:?]

at org.openhab.binding.km200.internal.handler.KM200GatewayHandler.initialize(KM200GatewayHandler.java:114) ~[?:?]

at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]

at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

If I get this right one difference between your installation and mine ist the Java engine used.
I’m running Zulu, but from the log I guess you are using Oracle. Have you tried with Zulu (including the strong encryption) ?
Regards
Oggerschummer

Yes, that is right and might actually be the cause. Thank you. I have been looking at hot to add Zulu onto my Qnap system. Do you have any idea ? I am a bit cautious (event though I think that it should be ok) but if somebody has an idea on how I should do that, I would be happy to hear any recommendations.

@Oggerschummer Thank you. As often, the answer was really close and you pointed me into the right direction. I got it up and running again !

Hi,
I have done some work on this binding and found some problems releated to your last comments. There were some problems during the dispose process of this binding (same reason if you have change the configuration). In some cases you would get a “hexString needs to have an even length” error message.
It would be great if you could test the new version.
Greetings
Markinus

Hello Markus,

What I did: Stopped OH and put the binding in place plus cleared the cache.

I can confirm that, running the latest version, the binding crash when changing the refresh interval is fixed. I no longer see the “invalid key length”-error.
The binding gateway goes offline, takes the things offline and comes back. Things go online again and the values are read as before.

Well done !

Could you please merge the precision fix into this version as well ? Currently it is missing.

Kind Regards and stay safe
Oggerschummer

Hi,
thank you for the feedback.
I added a fix but a different one. I didn’t like the last one. If I’m looking to the Control-Page inside of Paper UI then all Values have the single fraction. For you too?
Greetings