Tankerkoenig Binding now available on the marketplace

Hi,

I have upgraded to the latest snapshot release of openhab. The only binding which is not working anymore is Tankerkeonig:

following failure:

OFFLINE - COMMUNICATION_ERROR No valid response from the web-request!

could anybody help here?

best regards René

That sounds as if you do not get a correct return from the webrequest. Reading your questions here indicates that you have a working internet-connection, I’d assume the same for the system your are running OH from.

Please raise the log-level to DEBUG for this binding and check your logs for entries like:

 2017-06-25 16:02:12.679 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult IOException: 
java.io.IOException: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem

In this case you need to get a valid certificate for hhtps request. To way to get it can be found in the FAQ section of the docs under the topic: “-The Station(s) and Webservice stay OFFLINE”

Please report back if that doesn’t help.

Hi,

I get this failure from the DEBUG:

2017-09-23 19:53:59.174 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult IOException:
java.io.IOException: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: No negotiable cipher suite

I added again the certificate like described in the manual and restarted OH2 without any success :frowning:

Google says the following:
Cause Cipher Suites that are sent by the client application are not added to Broker’s SSL configuration

Looks like there was an change in the Binding and this configuration not done properly.

I don’t know from which version of tankerkönig binding you were coming, so I can’t say wether you got a change regardind the binding.
Even the latest change of that binding was tested by users without any complaints.

If you would use the http binding or a rule to test, you should see the same error (If my assumption is correct, otherwise yours).

Hi,

it looks like there was an change in OpenHab. I need to add the following line to the karaf file to be able to use the RWE smartome binding:
-Djdk.tls.client.protocols=TLSv1 \

This option prevents the TankerKoenig binding to connect to the API. It was not an problem in the older release. Is there maybe an workaround available to use the binding also in my configuration again.

I have checked also the old way to get the actual gas price over the http binding. This still works:

Number Diesel “Diesel [%.3f €]” {http=“<[https://creativecommons.tankerkoenig.de/json/detail.php?id=xxxxxxxxxxxxxxxxxxxxxxx&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxx:300000:JS(super.js)]”}

best regards René

Thanks for the fedback.
Personally I can’t say if there is a solution for your problem, my knowledge isn’t that wide.
I’m not even sure who could help. Searching…

Got a hint from @mstormi.

The adjusted setting:

-Djdk.tls.client.protocols=“TLSv1,TLSv1.1,TLSv1.2”

SHOULD be worth a try.
Where exactly did you insert your setting into the karaf file?

[Update]
I tried your setting in the IDE and got the same error! Changing the setting as suggested above removed the error!
Could you try it on your system with both bindings and report back?
…and the question where to put that line in the karaf file is still open (for me), setting the same in the IDE is defferent!

@rene54321
Just read your post in the other thread, that it isn’t working for the RWE binding.
?? I’m out of clues ATM, have to go thinking…

Did some thinking.
You used the Http binding successfully. At a first glance this binding uses the same HttpUtil as Tankerkoenig. IF THAT IS CORRECT there has to be a difference in the usage, which, when found, could be changed in the Tankerkoenig binding.
But that will take some time.

Ok,

thanks for your help Jürgen. At least I have an workaround with the HTTP binding. Hopefully I am able to use the binding again with an later release.

best regards René

A little note on your usage of the Http binding. You are calling the details script, which in turn is NOT suggested by tankerkoenig for frequent price-updates.
I haven’t tried it using a rule with your special TLS setting. If a rule would be working, you could use mine. I had it with the opening - time mode included (posted a couple of month ago, I’d have to search for it). Since OH2.1 is a bit more picky on syntax there might be some hickups, but it was running.

The rule is posted here: Getting fuel prices from Tankerkoenig.de

Hi,

I give it a try thanks but still preferred is the binding :frowning:

1 Like

The code that the http binding is using is the same as in the tanlkerkoenig binding!
The usage in the http binding:

response = HttpUtil.executeUrl("GET", url, headers, null, null, timeout);

in the tankerkoenig binding:

return HttpUtil.executeUrl("GET", url, urlHeader, null, "", REQUEST_TIMEOUT);

I tried to test it in the tankerkoenig binding with “null,null” also, finding it working with the setting of

-Djdk.tls.client.protocols=TLSv1

While trying to confirm that this change was the cause, I couldn’t raise the error again! Not without the original usage of the HttpUtil, nor with any setting. ???
Am I doing it correct in Eclipse,
I did add the “-Djdk.tls.client.protocols=TLSv1” to the end of the “VM Arguments” on the “Debug Configurations” window, Tab “(x)=Arguments”.
Anybody? @martinvw?

It sounds correct to me, strange that it first worked and then stopped working.

Thanks for the feedback.
My question for you was, did I correctly put in the “TLS” setting into Eclipse.
As @rene54321 reported while using the setting (TLSv1) set into the Karaf file he wasn’ t to use the tankerkoenig binding. However using the Http binding to do the request works for him.
I checked both codes are using HttpUtil for the request.
When trying to force the error (not working Http request) using the setting as stated initially the error appeared as posted. However after adding the Http binding the error disappeared, even after uninstalling the Http binding.
If I did the setting correctly in the IDE I will do further checks regarding this topic.

Can it be related to this? OH2 my.openHAB shows offline and nothing in logs

Another option is that the http binding configures something, but I cannot find the sources of http binding, do you have an idea in which sub project they live :sweat_smile:

I believe the http binding is a OH1 binding.

I guess I found MY stupid mistake. This setting needs to be added a the end of the existing settings at the VM arguments WITH a space before it!

I’ll have to continue the search tonight, , so far I couldn’t get it to work with the http binding.

Additionally: Since I did the checks on my Windows maschine (from which I never connected OH to my.openhab) that could be a valid point! (I at work now and can’t check.
@rene54321 could you check which Java Version you have on your system?

Back on the system:
My windows maschine is using java version “1.8.0_111”, so it is not this old problem!

@rene54321 posted to use something like:

Number Diesel “Diesel [%.3f €]” {http=“<[https://creativecommons.tankerkoenig.de/json/detail.php?id=xxxxxxxxxxxxxxxxxxxxxxx&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxx:300000:JS(super.js)]”}

That will call the openhab1 http binding which uses a httpUtil with the package “org.openbab.io.net.http”, while I’m using a httpUtil with a package of “org.eclipse.smarthome.io.net.http”. The one from openhab is using an “org.apache.commons.httpclient” while the eclipse one uses the jetty versions.
I’d say the reason that it works with the http binding is just this difference. However that doesn’t solve the problem that RWE-Smarthome and Tankerkoenig are not working in paralell.
I’m not sure if the differences of those httpUtils (besides the different httpclient) are intended that way.

Hi,

I use the following version:
java version "1.8.0_101"
Java™ SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot™ Client VM (build 25.101-b13, mixed mode)