New OH2 binding: Tankerkoenig

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

What do i need to enter in the Location field?

I know tankerkönig from my approach with the sorting of Gas Stations.
Is it possible to use the geolocation (which is requested by OH in the latest Build)

@opus Could you please have a look at the current documentation? There maybe is an error in the tankerkoenig.items.

Number E10_1 "E10 [%.3f €]" { channel="tankerkoenig:station:StationName1:e10" }
Number E5_1 "E5 [%.3f €]"  { channel="tankerkoenig:station:StationName1:e5" }
Number Diesel_1 "Diesel [%.3f €]" { channel="tankerkoenig:station:StationName1:diesel"}
Number E10_2 "E10 [%.3f €]" { channel="tankerkoenig:station:StationName2:e10"}
Number E5_2 "E5 [%.3f €]" { channel="tankerkoenig:station:StationName2:e5"}
Number Diesel_2 "Diesel [%.3f €]" { channel="tankerkoenig:station:StationName2:diesel"}

Should be: (EDIT: added WebserviceName between station and StationNameN)

Number E10_1 "E10 [%.3f €]" { channel="tankerkoenig:station:WebserviceName:StationName1:e10" }
Number E5_1 "E5 [%.3f €]"  { channel="tankerkoenig:station:WebserviceName:StationName1:e5" }
Number Diesel_1 "Diesel [%.3f €]" { channel="tankerkoenig:station:WebserviceName:StationName1:diesel"}
Number E10_2 "E10 [%.3f €]" { channel="tankerkoenig:station:WebserviceName:StationName2:e10"}
Number E5_2 "E5 [%.3f €]" { channel="tankerkoenig:station:WebserviceName:StationName2:e5"}
Number Diesel_2 "Diesel [%.3f €]" { channel="tankerkoenig:station:WebserviceName:StationName2:diesel"}

wdyt?

You are talking about the Location field on PaperUI? In my opinion this field is used to seperate the Things in the section Control of PaperUI. It is just a text filed to sort the Things.

I have seen that in the logs posted above. I’ll have a close look and will verify. I did my trests using the documeted files, so I think both should work. However, if it logs that way, the documentation better reads the same!

Could you do another try with this bundle set to DEBUG level: “org.eclipse.smarthome.io.net” and try to get the log of your requests from Tankerkoenig.de (to be found in the Tab Tools on the creativecommons.tankerkoenig.de page). If you get this log do send it via PM because it contains your API key (if you trust me).

Hey @opus and @hendrik1287,

I faced a similiar problem months ago when I used a simple web request (with http-binding) and rule for getting the gas prices. (This was also the most annoying point, when I decided to start this binding :slight_smile: )

The reason was a missing certificate, which I installed on my raspberry. Maybe the ones who already worked with the simple web request before don’t get this error because the already installed the certificate.

Have a look at this post. At the end it is explained how you get the certificate installed:

http://www.marcsblog.de/2015/09/tankstellenpreis-in-openhab-anzeigen/

So please give it a try and tell us about the results. If this won’t help, we’ll find another solution :wink:

2 Likes

Hi @opus and @dolic,

I was just able to test my setup on my second Windows 10 pc, I simply copied my setup and everything is working. I get results from tankerkoening without an exception. From my point of view it looks like a local problem on my pc. Maybe the hint with the missing ceritficate is a good starting point for further analysis on. Unfortunately I am not able to test this before friday, but I will try it out and will report my results.

1 Like

@dolic
Thanks for that hint. Yes, that does ring a bell.
@hendrik1287
I think it is that problem, I simply forgot that episode. Take your time, I’ll be standing by.

Hi
how can I select the bridge / web services for Tankerkoenig in OH2? I have an API Key and a Tankstellen ID but Paper UI sells my “Could not find bridge (tankerkoenig config)”. The Binding is Offline.

I assume you have both setup, in this case check the logs If you see errors as posted above by @hendrik1287 I assume you also have the SSL-key problem.
Use the link to Marcs blog in the post from dolic after you renewed the key it should work. Please report back in any case.

[Edit]
Ssorry for the short answer from this morning. After a look into the code I would believe that you did not setup the Web service, because that specific error is shown when no bridge is set. The API-Key isn’t checked at that time yet.

I started with a rule like you’re thinking of and didnt like the ammount of messages I received.
Thus I moved on and calculate the “cheapest price for 3 days” using persistance.
In case the actual gas price is equal or lower than the 3days AVG, I do send a telegram message.
Works nicely!

I was using tankerkoenig with the http binding already. I’m about to migrate to the newly released binding.

I hesitated to mention those frequent price drops. I’m using the rrd4j persisted prices to display graphs for the last day, week and month. That way I see at what time of day it is cheapest and if there are days with lower prices to come. After a year I get pretty good at it.
I even can see new habits in the price changes, like the relative new price raise around 18:00, which is followed by the last two drops of the day.

Sorry, don’t know how to setup the web service bridge. I put the bridge section into the .things file but: “tankerkoenig:station:82e601b2 (Type=Thing, Status=OFFLINE (BRIDGE_OFFLINE): Could not find bridge (tankerkoenig config). Did you select one?, Label=Tankstelle, Bridge=null)” Any Idea’?