New OH2 binding: Tankerkoenig

Hi,

I can confirm that it is not working without the webservice part in the items file.

My setup: openhab 2.1 stable on Ubuntu 16.04 with an all text file configuration.

Greetings
Sebastian

1 Like

Thanks and I’m sorry for not finding the time to confirm and change the ReadMe. It’s on my ToDo-List

The changes got merged into the Snapshot version. See the readme in here: `https://github.com/openhab/openhab2-addons/blob/master/addons/binding/org.openhab.binding.tankerkoenig/README.md

Thanks for the inputs @hannibal29, @dolic, @hendrik1287,@cweitkamp

@opus tyvm. Go on with your good work.

The next update is already in its final stages. In order to use the mode opening times correctly, the treatment of holidays needs to be added.
Since my initial version with a complete calculation of all holidays (only those that are valid in all states) wasn’t accepted, I’m going to PR a version with a “holiday” channel ( a channel that reads the state of a switch, which in turn could be set manually, by a rule or by the Caldav bing).

Hello together,

I read the complete thread, but it seems, that I have another problem. I get the following exception:

13:47:37.473 [DEBUG] [ig.internal.data.TankerkoenigService] - Error in getTankerkoenigListResult:
java.io.IOException: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:255)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:149)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:122)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getResponseString(TankerkoenigService.java:67)[219:org.openhab.binding.tankerkoenig:2.1.0]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigListResult(TankerkoenigService.java:77)[219:org.openhab.binding.tankerkoenig:2.1.0]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationListData(TankerkoenigService.java:44)[219:org.openhab.binding.tankerkoenig:2.1.0]
at org.openhab.binding.tankerkoenig.handler.WebserviceHandler.updateStationData(WebserviceHandler.java:137)[219:org.openhab.binding.tankerkoenig:2.1.0]
at org.openhab.binding.tankerkoenig.handler.WebserviceHandler$1.run(WebserviceHandler.java:95)[219:org.openhab.binding.tankerkoenig:2.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:110)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:655)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:246)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
… 14 more
Caused by: java.nio.channels.ClosedChannelException
at org.eclipse.jetty.io.WriteFlusher.onClose(WriteFlusher.java:482)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractEndPoint.onClose(AbstractEndPoint.java:109)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractEndPoint.close(AbstractEndPoint.java:116)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.close(SslConnection.java:913)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:667)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:841)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:408)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.WriteFlusher.completeWrite(WriteFlusher.java:364)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$1.run(SslConnection.java:98)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]

The API-Key is valid and the station io too. I’ve validated this via a simple https-Call to the prices.php. The certificate, described some posts above, i’ve installed.

Any ideas?

Hi, I’ll look closer into that after the weekend.
From the error posted it has to be something inside the prosecution of the return from Tankerkoenig.de.

Could you raise your debug level for that binding by the following command onto the Karaf console:

log:set DEBUG org.openhab.binding.tankerkoenig

That way we will get a bit more information about the problem.
As an initial guess, what was the return of the posted request onto the browser, a return with only some prices maybe?

The log level you want, is set and the Exception trace is taken with that level.
The return of the request onto browser is a JSON with a list of prices. Note: I take the URI for the request from the log, but I will it not post here, because there is my API-Key inside. The result JSON is:

{“ok”:true,“license”:“CC BY 4.0 - https://creativecommons.tankerkoenig.de”,“data”:“MTS-K”,“prices”:{“51d4b529-a095-1aa0-e100-80009459e03a”:{“status”:“open”,“e5”:1.309,“e10”:1.289,“diesel”:1.119},“51d4b490-a095-1aa0-e100-80009459e03a”:{“status”:“open”,“e5”:1.349,“e10”:1.329,“diesel”:1.159},“d7203f5a-1c7d-41a4-90e1-3ae57e0f760f”:{“status”:“open”,“e5”:1.369,“e10”:1.349,“diesel”:1.179},“13c07bcd-cfe8-4be2-bc32-d518643020d2”:{“status”:“open”,“e5”:1.299,“e10”:1.279,“diesel”:1.109},“b4d96bec-b357-439e-bc21-d0fddd8ef843”:{“status”:“open”,“e5”:1.379,“e10”:false,“diesel”:1.189},“c33fde8d-19f1-4671-bcc7-6e2f27c421c2”:{“status”:“open”,“e5”:1.359,“e10”:1.339,“diesel”:1.169},“8ca6cf1e-a53a-42a2-9d36-9fae63dfca67”:{“status”:“open”,“e5”:1.319,“e10”:1.299,“diesel”:1.129}}}

Other hints:
OH2 running on RaspPi2. Pi have internet access.

Thanks for those inputs. Nothing in the return should be causing this problem.
Is the error coming all the time?
As said before,I’ll have time earliest on a Monday to look into that, if deeper changes would be needed, I would have to postpone that even until to the end of this month, since I’m far from home.

I’m sorry, but reading such posts on a smartphone is asking for error. The reply from Tankerkoenig you got in the browser does have a problem.
One station reports “false” instead of a price for E10, most probably this is causing the problem, leaving out this station at ye moment should resolve the problem until I can come up with a revised code.

What version are you on, since this might have already been solved in athe snapshot version.

I’m currently at work stressed too and I don’t know, when I have time on weekend.
So take your time for the analysis
I tried it without the false flagged station, but the problem persists.

Maybe it makes sense, that I give you remote access to my Pi. I’ll explore the possibilities for that and I’ll contact you for that via PM.

Thanks and have a nice weekend

In case you have time please give following information:
Version used (OH stable release 2.1 or snapshot release 2.2)
Do all stations change to online? If not please provide the log readout for that station which gives the full web-return.
Please post the web-return of all stations before the error. (Probably a single return as posted above).
Do delete your API key in all cases.
Using those web-returns I should be able to get your observed error. That way no direct connection to your system is needed.

  • Version 2.1.0 release build
  • Nothing of all the stations are changed to ONLINE. All stations change from INITIALIZING to UNKNOWN and then to OFFLINE
  • But what do you mean with “web-return”?

In the log the returns from Tankerkoenig are included if DEBUG level is set.
If all the Stations remain OFFLINE there is probably only one return for each station.
I have made some changes to the binding already, which are in the Snapshot release. Those changes did also cover if a Station does not give all the prices, since you are getting an error even without the station reporting no E10 price, that might not help.
You do not need to change to the full snapshot release (2.2), by deinstalling the binding via PaperUI and placing only the updated binding into the addons folder you would use the new one.

How I can find the updated binding? Did you have a link? I can find only the OH2.2 distro on Github.

You should be able to download it from here.

After you have deinstalled via PaperUI and installed the new version by putting it into the addons folder you can check wether the correct one is used on the Karaf console. Use “bundle:list” to show all addons, there should only be one Tankerkoening binding listed, with version 2.2.0 followed by a DateTimeGroup.

After installing you need to delete all (Tankerkoenig)things created with the old binding and reinsert them! (Otherwise they will not use the complete new code).

If you have successfully installed the new binding and see errors again, please post the logs (without API-keys) else…

New version installed and active (I see it via bundle:list), but not happens. Here is the log from startup (only tankerkoenig messages).

pi@pi:/opt/openHAB2 $ ./start_debug.sh
Launching the openHAB runtime…
Listening for transport dt_socket at address: 5005

                      __  _____    ____

____ ____ ___ ____ / / / / | / __ )
/ __ / __ / _ / __ / // / /| | / __ |
/ /
/ / // / __/ / / / __ / ___ |/ // /
_/ ./_// /// /// |/_____/
/_/ 2.1.0
- release build -

Hit ‘’ for a list of available commands
and ‘[cmd] --help’ for help on a specific command.
Hit ‘’ or type ‘system:shutdown’ or ‘logout’ to shutdown openHAB.

openhab> log:tail
10:55:20.678 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link ‘E10_JetFreiberg-tankerkoenig:station:WebserviceName:StationJetFreiberg:e10’ has been added.
10:55:21.401 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'tankerkoenig.things’
10:56:19.117 [DEBUG] [org.openhab.binding.tankerkoenig ] - BundleEvent STARTING - org.openhab.binding.tankerkoenig
10:56:19.130 [DEBUG] [org.openhab.binding.tankerkoenig ] - BundleEvent STARTED - org.openhab.binding.tankerkoenig
10:56:19.146 [DEBUG] [org.openhab.binding.tankerkoenig ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=binding.tankerkoenig, component.id=216, service.id=342, service.bundleid=223, service.scope=bundle} - org.openhab.binding.tankerkoenig
10:56:20.981 [INFO ] [smarthome.event.ThingAddedEvent ] - Thing ‘tankerkoenig:webservice:WebserviceName’ has been added.
10:56:21.054 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘tankerkoenig:webservice:WebserviceName’ changed from UNINITIALIZED to INITIALIZING
10:56:21.055 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Initialize Bridge
10:56:21.069 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘tankerkoenig:webservice:WebserviceName’ changed from INITIALIZING to UNKNOWN
10:56:21.076 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Refresh job scheduled to run every 10 min. for 'tankerkoenig:webservice:WebserviceName’
10:56:21.086 [INFO ] [smarthome.event.ThingAddedEvent ] - Thing ‘tankerkoenig:station:WebserviceName:StationJetFreiberg’ has been added.
10:56:21.105 [DEBUG] [.tankerkoenig.handler.StationHandler] - Initializing Tankerkoenig handler 'tankerkoenig:station:WebserviceName:StationJetFreiberg’
10:56:21.105 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘tankerkoenig:station:WebserviceName:StationJetFreiberg’ changed from UNINITIALIZED to INITIALIZING
10:56:21.117 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘tankerkoenig:station:WebserviceName:StationJetFreiberg’ changed from INITIALIZING to UNKNOWN
10:56:21.126 [DEBUG] [.tankerkoenig.handler.StationHandler] - Refresh job scheduled to run every 24 hours for 'tankerkoenig:station:WebserviceName:StationJetFreiberg’
10:56:36.126 [DEBUG] [.tankerkoenig.handler.StationHandler] - Try to refresh detail data
10:56:36.395 [DEBUG] [lipse.smarthome.io.net.http.HttpUtil] - About to execute https://creativecommons.tankerkoenig.de/json/detail.php?id=51d4b529-a095-1aa0-e100-80009459e03a&apikey=[Removed]
10:56:37.335 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult IOException:
java.io.IOException: java.util.concurrent.TimeoutException
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:255)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:149)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:122)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getResponseString(TankerkoenigService.java:67)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigDetailResult(TankerkoenigService.java:90)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationDetailData(TankerkoenigService.java:48)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.handler.StationHandler.updateDetailData(StationHandler.java:156)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.handler.StationHandler$1.run(StationHandler.java:94)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.util.concurrent.TimeoutException
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:109)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:655)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:246)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
… 14 more
10:56:37.375 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘tankerkoenig:station:WebserviceName:StationJetFreiberg’ changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): No valid response from the web-request!

OK.
Just got make sure, did you copy the full request (the one from which removed the API key) from the log into the browser and get a valid response? I apologise for that question, but when searching for errors you got that be sure of every step.
If that is true,please request a log-file from Tankerkoenig.de (under https://creativecommons.tankerkoenig.de menu item Tools) and verify if the requests of the binding did go to them at all.
The reason I’m searching primarily in that direction is that others do not report such failure!

I check to log file from Tankerkoenig.de and I see, that the request of the binding is not received by the server. In my opinion, that fact match with the timeout message. I see only my test requests from the browser. Note: I used the Epiphany browser direct under the Pi Desk.

[MyExternalIP-Removed] - - [06/Nov/2017:14:55:56 +0100] “GET /json/detail.php?id=51d4b529-a095-1aa0-e100-80009459e03a&apikey=[Removed] HTTP/1.1” 200 417 “-” “Mozilla/5.0 (Macintosh; ARM Mac OS X) AppleWebKit/538.15 (KHTML, like Gecko) Safari/538.15 Version/6.0 Raspbian/8.0 (1:3.8.2.0-0rpi27rpi1g) Epiphany/3.8.2” 0.007

Sometimes I get another exception with the same negative result:
15:18:59.032 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult IOException:
java.io.IOException: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:255)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:149)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:122)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getResponseString(TankerkoenigService.java:67)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigDetailResult(TankerkoenigService.java:90)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationDetailData(TankerkoenigService.java:48)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.handler.StationHandler.updateDetailData(StationHandler.java:156)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at org.openhab.binding.tankerkoenig.handler.StationHandler$1.run(StationHandler.java:94)[223:org.openhab.binding.tankerkoenig:2.2.0.201711051935]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_65]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_65]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_65]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_65]
Caused by: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:110)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:655)[68:org.eclipse.jetty.client:9.2.19.v20160908]
at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:246)[113:org.eclipse.smarthome.io.net:0.9.0.b5]
… 14 more
Caused by: java.nio.channels.ClosedChannelException
at org.eclipse.jetty.io.WriteFlusher.onClose(WriteFlusher.java:482)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractEndPoint.onClose(AbstractEndPoint.java:109)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractEndPoint.close(AbstractEndPoint.java:116)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.close(SslConnection.java:913)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:667)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.flush(SslConnection.java:841)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:408)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.WriteFlusher.completeWrite(WriteFlusher.java:364)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.io.ssl.SslConnection$1.run(SslConnection.java:98)[71:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
… 1 more