New OH2 binding: Tankerkoenig

I’m glad to hear that, thanks for the feedback.
If you have any further question, don’t hesitate to call.

hello!

actually i got problems again with the binding - the things are not initializised. also i saw, that there are two bindings now at the add-ons - of course i tried both.

didnt find anything in the errorlog.

thanks for help.

yours alex

One of them comes from the market, see the grey name on the first entry.

When a binding is merged into the core, you have to delete the entry on the Eclipse market.

@e36Alex
The above is correct, you have the Marketplace version and the brandnew snapshot version.
During the release process several were necessary resulting in a situation that you need to re-setup the Webswrvice (bridge) and Statiobs (things ).
That is also described as comment in the marketplace.
@hakan
Thanks for stepping in.
In my understanding I should remove the Marketplace version when the binding is in the release version. Please advise if I’m mistaken.

Looking a bit closer, you installed only the Snapshot version. This one should show the Stations and Webservice go ONLINE within a minute. If not check a Station if it shows more detail. I’d assume the cause in a wrong API key or no connection.
If you raise to DEBUG level to log will show more detail.
[Edit]
TI misread , in the picture you have the Marketplace version installed. In the one from laSt week, it can take a while until anything goes ONLINE,you have to for a complete Refresh Time , only after that prices will get updated and all things go ONLINE Refresh Time default is 60 minutes!

You should remove the Marketplace entry after the binding PR is merged. Unfortunately, I did not find a way to “disable” the entry (and totally forgot to open up an Issue for this functionality)

When you have a new PR, changing what is merged into the master, you can always re-create the Marketplace entry.

Will do immidiatly

Hi,

I’m a newbie in OH and have problems with this binding. I copied the sample from the official binding description, but I get no results. These are the log entries:

2017-06-25 12:39:25.749 [ThingAddedEvent           ] - Thing 'tankerkoenig:webservice:WebserviceName' has been added.
2017-06-25 12:39:25.899 [hingStatusInfoChangedEvent] - 'tankerkoenig:webservice:WebserviceName' changed from UNINITIALIZED to INITIALIZING
2017-06-25 12:39:25.899 [hingStatusInfoChangedEvent] - 'tankerkoenig:webservice:WebserviceName' changed from INITIALIZING to UNKNOWN
2017-06-25 12:39:25.903 [ThingAddedEvent           ] - Thing 'tankerkoenig:station:WebserviceName:StationName1' has been added.
2017-06-25 12:39:25.906 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName2' changed from INITIALIZING to UNKNOWN
2017-06-25 12:39:25.907 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName1' changed from UNINITIALIZED to INITIALIZING
2017-06-25 12:39:25.908 [ThingAddedEvent           ] - Thing 'tankerkoenig:station:WebserviceName:StationName2' has been added.
2017-06-25 12:39:25.909 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName1' changed from INITIALIZING to UNKNOWN
2017-06-25 12:39:25.909 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName2' changed from UNINITIALIZED to INITIALIZING
2017-06-25 12:39:41.229 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName2' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Empty return or no internet connection
2017-06-25 12:39:41.261 [hingStatusInfoChangedEvent] - 'tankerkoenig:station:WebserviceName:StationName1' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Empty return or no internet connection

Can anyone help me with this problem?

Have you used your personal API-Key as received from Tankerkoenig.de?
If yes, please raise logging level to Debug for this binding and post the relevant entries when trying to setup the binding.

I have now changed the log level to debug, this is what I can see in the log:

2017-06-25 15:53:00.367 [DEBUG] [org.openhab.binding.tankerkoenig    ] - BundleEvent INSTALLED - org.openhab.binding.tankerkoenig
2017-06-25 15:53:00.462 [DEBUG] [org.openhab.binding.tankerkoenig    ] - BundleEvent RESOLVED - org.openhab.binding.tankerkoenig
2017-06-25 15:53:00.464 [DEBUG] [org.openhab.binding.tankerkoenig    ] - BundleEvent STARTING - org.openhab.binding.tankerkoenig
2017-06-25 15:53:00.477 [DEBUG] [org.openhab.binding.tankerkoenig    ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=binding.tankerkoenig, component.id=188, service.id=319, service.bundleid=194, service.scope=bundle} - org.openhab.binding.tankerkoenig
2017-06-25 15:53:00.481 [DEBUG] [org.openhab.binding.tankerkoenig    ] - BundleEvent STARTED - org.openhab.binding.tankerkoenig
2017-06-25 15:54:06.852 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'tankerkoenig.things'
2017-06-25 15:54:06.867 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Initialize Bridge
2017-06-25 15:54:06.869 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Refresh job scheduled to run every 60 min. for 'tankerkoenig:webservice:WebserviceName'
2017-06-25 15:54:06.873 [DEBUG] [.tankerkoenig.handler.StationHandler] - Initializing Tankerkoenig handler 'tankerkoenig:station:WebserviceName:StationName1'
2017-06-25 15:54:06.875 [DEBUG] [.tankerkoenig.handler.StationHandler] - Refresh job scheduled to run every 24 hours for 'tankerkoenig:station:WebserviceName:StationName1'
2017-06-25 15:54:06.884 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'tankerkoenig.things'
2017-06-25 15:54:06.897 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Initialize Bridge
2017-06-25 15:54:07.041 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Refresh job scheduled to run every 60 min. for 'tankerkoenig:webservice:WebserviceName'
2017-06-25 15:54:07.042 [DEBUG] [.tankerkoenig.handler.StationHandler] - Initializing Tankerkoenig handler 'tankerkoenig:station:WebserviceName:StationName1'
2017-06-25 15:54:07.043 [DEBUG] [.tankerkoenig.handler.StationHandler] - Refresh job scheduled to run every 24 hours for 'tankerkoenig:station:WebserviceName:StationName1'
2017-06-25 15:54:22.044 [DEBUG] [.tankerkoenig.handler.StationHandler] - Try to refresh detail data
2017-06-25 15:54:22.176 [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.201706211517]
	at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:149)[113:org.eclipse.smarthome.io.net:0.9.0.201706211517]
	at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:122)[113:org.eclipse.smarthome.io.net:0.9.0.201706211517]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getResponseString(TankerkoenigService.java:67)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigDetailResult(TankerkoenigService.java:90)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationDetailData(TankerkoenigService.java:48)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.handler.StationHandler.updateDetailData(StationHandler.java:133)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.handler.StationHandler$1.run(StationHandler.java:90)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_66]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_66]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_66]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
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.201706211517]
	... 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

After a restart I get the following exception:

2017-06-25 16:02:12.424 [DEBUG] [.tankerkoenig.handler.StationHandler] - Try to refresh detail data
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
	at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:255)[113:org.eclipse.smarthome.io.net:0.9.0.201706211517]
	at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:149)[113:org.eclipse.smarthome.io.net:0.9.0.201706211517]
	at org.eclipse.smarthome.io.net.http.HttpUtil.executeUrl(HttpUtil.java:122)[113:org.eclipse.smarthome.io.net:0.9.0.201706211517]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getResponseString(TankerkoenigService.java:67)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigDetailResult(TankerkoenigService.java:90)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationDetailData(TankerkoenigService.java:48)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.handler.StationHandler.updateDetailData(StationHandler.java:133)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at org.openhab.binding.tankerkoenig.handler.StationHandler$1.run(StationHandler.java:90)[194:org.openhab.binding.tankerkoenig:2.1.0.201706241642]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_66]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_66]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_66]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_66]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
Caused by: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
	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.201706211517]
	... 14 more
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
	at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1431)[:1.8.0_66]
	at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:535)[:1.8.0_66]
	at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:813)[:1.8.0_66]
	at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)[:1.8.0_66]
	at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)[:1.8.0_66]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:520)[71:org.eclipse.jetty.io:9.2.19.v20160908]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:111)[68:org.eclipse.jetty.client:9.2.19.v20160908]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69)[68:org.eclipse.jetty.client:9.2.19.v20160908]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:89)[68:org.eclipse.jetty.client:9.2.19.v20160908]
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:123)[68:org.eclipse.jetty.client:9.2.19.v20160908]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[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
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)[:1.8.0_66]
	at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1728)[:1.8.0_66]
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:304)[:1.8.0_66]
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)[:1.8.0_66]
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1509)[:1.8.0_66]
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)[:1.8.0_66]
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)[:1.8.0_66]
	at sun.security.ssl.Handshaker$1.run(Handshaker.java:919)[:1.8.0_66]
	at sun.security.ssl.Handshaker$1.run(Handshaker.java:916)[:1.8.0_66]
	at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_66]
	at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1369)[:1.8.0_66]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:620)[71:org.eclipse.jetty.io:9.2.19.v20160908]
	... 8 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)[:1.8.0_66]
	at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)[:1.8.0_66]
	at sun.security.validator.Validator.validate(Validator.java:260)[:1.8.0_66]
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)[:1.8.0_66]
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:281)[:1.8.0_66]
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136)[:1.8.0_66]
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496)[:1.8.0_66]
	... 15 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:146)[:1.8.0_66]
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)[:1.8.0_66]
	at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)[:1.8.0_66]
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)[:1.8.0_66]
	... 21 more

Looking at the log it seems to me as if there is a problem getting the web request out. But I’m not sure on that. The binding itself does not use any SSL.
Could you check if the system on which OH2 runs has access to the Internet?
I’m on travel now, so I can’t do some checks with the development system now. I’ll do that as soon as possible.
Could you post a bit more information about your system, OH2 on what system, special setup (like docker)…

…and please positively confirm that you are using a personal API-Key and IDs for the Stations 1 and 2 and NOT just the copy from the ReadMe.
I’m sorry for that question, but I need to make sure.

Yes, I’m using a personal API-Key and real IDs for the stations. I’ve tested two different API-keys, both with the same result. At the moment OH2 is running on my Windows 10 desktop with internet access, so no special setup. I’ll test it on another pc in the next days, perhaps it’s a problem on my pc.

Thank you the answer.
A new OPENHAB user who can give that much information on his/here problem isn’t standard!:+1:

I’m missing exactly the next code line in the binding after the web-request to Tankerkoenig. It should be the logging of the returnIng json-string.
Since it isn’t coming (correct?) the problem has to be somewhere in the HttpUtil. This one is just used by the binding.
It works for others running the same binding. Because of that I’d assume a more local problem at the moment.
But I 'm in a train and not in front of my system.

BTW: Using two API-Keys from Tankerkoenig might result in a ban! Read their instructions!

Hi all,

did anyone create a setup (items and rules) for sending a notification if the price drops under a user defined value?

I would suggest one Number item for defining the threshold, optionally an Switch item to remember if a notification was send and one (or more) rule triggering on each change of the favorite gas. The rule checks if the new value is less than the defined threshold. If so, send a notification with your favorite service. One could use a Setpoint element in a sitemap for adjusting the threshold. The Switch item to remember if a notification was send should reset at night or whenever the threshold changes.

Question is, how to use this best with more than one gas station?

My development system is on a Windows 10 pc, in other words nothing special on your setup.

IMHO a single rule with triggers for all the observed channels/ Stations combined via OR should be the way to go.

@opus thanks for your quick reply. I thought about that. How do I check the price? Using the command variable. The notification should contain some information which gas station triggers my ‘price alarm’. Is it possible to evaluate which ‘or combined’ trigger did the catch? If not, I will put my items into a group and iterate over them.

To the best of my knowledge the way to do that is exactly iterating . Using a group will help to do that.
How the check the price? Don’t you have an item linked to the desired price? The change of such an item would be the trigger.

Of course I have. The way to go is clear now. Post my results, if solutions works and anybody is interested.

Thanks for help.

1 Like