openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[Tankerkönig] BridgeHandler Runtime Exception (Expected NUMBER but was BOOLEAN) #2676

Closed BOFH90 closed 7 years ago

BOFH90 commented 7 years ago

I´m using the latest 2.2.0 Binding and a few Stations. They are online and deliver Data for about 2-3 hours, but then they suddenly go offline with the following Error:

09:57:56.380 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Caught exception in ScheduledExecutorService of BridgeHandler. RuntimeException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:200)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:810)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:875)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:848)[12:com.google.gson:2.3.1] at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigListResultDeserializer.deserialize(CustomTankerkoenigListResultDeserializer.java:56)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigListResultDeserializer.deserialize(CustomTankerkoenigListResultDeserializer.java:1)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:810)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:775)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:724)[12:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:696)[12:com.google.gson:2.3.1] at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigListResult(TankerkoenigService.java:79)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationListData(TankerkoenigService.java:44)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at org.openhab.binding.tankerkoenig.handler.WebserviceHandler.updateStationData(WebserviceHandler.java:142)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at org.openhab.binding.tankerkoenig.handler.WebserviceHandler$1.run(WebserviceHandler.java:100)[185:org.openhab.binding.tankerkoenig:2.2.0.201709061429] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_131] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_131] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_131] at java.lang.Thread.run(Thread.java:748)[:1.8.0_131] Caused by: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN at com.google.gson.internal.bind.JsonTreeReader.nextDouble(JsonTreeReader.java:172)[12:com.google.gson:2.3.1] at com.google.gson.Gson$3.read(Gson.java:259)[12:com.google.gson:2.3.1] at com.google.gson.Gson$3.read(Gson.java:253)[12:com.google.gson:2.3.1] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:103)[12:com.google.gson:2.3.1] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:196)[12:com.google.gson:2.3.1] ... 21 more 09:57:56.384 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:2045a68f 09:57:56.393 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:c6eda56d 09:57:56.393 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:37a2b4a4 09:57:56.393 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:f8e51946 09:57:56.394 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:8310c0be 09:57:56.394 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:ebd629cb 09:57:56.394 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:c3d01c49 09:57:56.394 [DEBUG] [.tankerkoenig.handler.StationHandler] - Bridge Status updated to OFFLINE for device: tankerkoenig:station:fa43b520

JueBag commented 7 years ago

Looking for the cause. Could you post the station ID you are using= And could you post a bit more of the log, I'd need to see entries beore the OFFLINE started.

JueBag commented 7 years ago

Did some testing with a station that does only sell E5 and Diesel. For E10 it reports "null" instead of "False" as stated by Tankerkoenig. Hence the error is a bit different. My station did not report E10 from the beginning, therefore the first error occurs in "CustomTankerkoenigDetailResultDeserializer", in your case it was in "CustomTankerkoenigListResultDeserializer". That way your station must have stopped the reporting a fuel-type after "2-3 houres".

So, I think that the observed error is caused by a station that changed to providing only a subset of the 3 fuel-types. I would change the code therefore in order to show a Zero price for the fulel-type not reported. In the meantime, try to avoid stations that do not report all fuel-stations.

BOFH90 commented 7 years ago

Here are the Request the Binding does with included Station-ID´s: 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=3549a83a-6f8f-4581-9ff3-6cc8dcd48060&apikey=HIDDENAPIKEY HTTP/1.1" 200 343 "-" "Jetty/9.2.19.v20160908" 0.008 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=af6c18ec-13d2-4955-91ab-d9b1711ee08f&apikey=HIDDENAPIKEY HTTP/1.1" 200 330 "-" "Jetty/9.2.19.v20160908" 0.008 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=9e76d9d4-d3b5-4843-ac5b-fca936e19845&apikey=HIDDENAPIKEY HTTP/1.1" 200 335 "-" "Jetty/9.2.19.v20160908" 0.006 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=00060671-0066-4444-8888-acdc00000066&apikey=HIDDENAPIKEY HTTP/1.1" 200 349 "-" "Jetty/9.2.19.v20160908" 0.009 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=17aebe85-fcf2-4a83-9a9a-2be8333ba229&apikey=HIDDENAPIKEY HTTP/1.1" 200 408 "-" "Jetty/9.2.19.v20160908" 0.007 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=bff8204b-118c-4b98-9c4c-9328e1af2be8&apikey=HIDDENAPIKEY HTTP/1.1" 200 374 "-" "Jetty/9.2.19.v20160908" 0.006 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=85e74ae1-1b13-4f46-a363-d4bbe4da8143&apikey=HIDDENAPIKEY HTTP/1.1" 200 409 "-" "Jetty/9.2.19.v20160908" 0.008 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=13b7e970-93c9-4da9-8fb3-7039736f687c&apikey=HIDDENAPIKEY HTTP/1.1" 200 415 "-" "Jetty/9.2.19.v20160908" 0.009 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=5381c010-4e70-412a-b32c-a4d240f80a75&apikey=HIDDENAPIKEY HTTP/1.1" 200 336 "-" "Jetty/9.2.19.v20160908" 0.010 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=994db5ca-f516-4ade-be1d-ccfa27fe0ebe&apikey=HIDDENAPIKEY HTTP/1.1" 200 419 "-" "Jetty/9.2.19.v20160908" 0.011 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=00060029-0003-4444-8888-acdc00000003&apikey=HIDDENAPIKEY HTTP/1.1" 200 344 "-" "Jetty/9.2.19.v20160908" 0.003 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=8a329f9a-5c1d-4487-a652-acd654a7717f&apikey=HIDDENAPIKEY HTTP/1.1" 200 414 "-" "Jetty/9.2.19.v20160908" 0.008 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=f81e4ddd-a4a0-4452-aa3c-e421a9bcfe04&apikey=HIDDENAPIKEY HTTP/1.1" 200 343 "-" "Jetty/9.2.19.v20160908" 0.009 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=02856f72-29d6-4569-ad31-fa42c8ddd891&apikey=HIDDENAPIKEY HTTP/1.1" 200 402 "-" "Jetty/9.2.19.v20160908" 0.009 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=00060182-0001-4444-8888-acdc00000001&apikey=HIDDENAPIKEY HTTP/1.1" 200 347 "-" "Jetty/9.2.19.v20160908" 0.004 46.252.133.186 - - [07/Sep/2017:13:41:51 +0200] "GET /json/detail.php?id=fe4f96fc-0a0d-4bc2-910b-9ba4ba763360&apikey=HIDDENAPIKEY HTTP/1.1" 200 412 "-" "Jetty/9.2.19.v20160908" 0.009

JueBag commented 7 years ago

This log raises some questions:

JueBag commented 7 years ago

Is this the log you get from Tankerkoenig.de? Or elsewhere? The log shows 15 detail requests for 14 different stations. All at the same time. Using the binding only 10 stations can be called. I would not expect to see only detail requests, they are done for each station only at startup and every 24 hours

BOFH90 commented 7 years ago

The log is from Tankerkoenig.de Ive talked to them and got the ok to call more than the 10 Station as this is required. I also recompiled the Binding and changed the max allowed Stations to 99 for this to work. I also done this before with only 8 stations and got the same problem as now.

JueBag commented 7 years ago

Ok, you talked to Tankerkoenig. Does your observation fit my assumption posted above that the error is caused by station(s) not reporting all prices? Would a report of 0,00 be OK in case of a not reported price?

martinvw commented 7 years ago

Would a report of 0,00 be OK in case of a not reported price?

I would prefer some form of undefined

BOFH90 commented 7 years ago

I thnik so too, as i write the Data into a InfluxDB for Grafana and the Table would be wrong if it´s reporting a Value of 0.

JueBag commented 7 years ago

I'll do my very best.

BOFH90 commented 7 years ago

Is it also possible to define the maximum limit of stations (10) as a variable?

cweitkamp commented 7 years ago

Hard to find a station which only sells one type of gas. Here you got some more logs for a station only selling "Diesel".

2017-09-08 13:10:54.851 [DEBUG] [.tankerkoenig.handler.StationHandler] - Initializing Tankerkoenig handler 'tankerkoenig:station:4c187408'
2017-09-08 13:10:54.852 [DEBUG] [.tankerkoenig.handler.StationHandler] - Refresh job scheduled to run every 24 hours for 'tankerkoenig:station:4c187408'
2017-09-08 13:11:09.852 [DEBUG] [.tankerkoenig.handler.StationHandler] - Try to refresh detail data
2017-09-08 13:11:09.935 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult jsonData : {"ok":true,"license":"CC BY 4.0 -  https:\/\/creativecommons.tankerkoenig.de","data":"MTS-K","status":"ok","station":{"id":"fe2cb4f1-42a6-4f25-bbec-63f93a440245","name":"Raiffeisen-Landbund eG","brand":"Raiffeisen","street":"Birkenweg","houseNumber":"2","postCode":32479,"place":"Hille-Hartum","openingTimes":[],"overrides":[],"wholeDay":true,"isOpen":true,"e5":null,"e10":null,"diesel":1.079,"lat":52.3162,"lng":8.8264,"state":null}}
2017-09-08 13:11:09.936 [DEBUG] [.tankerkoenig.handler.StationHandler] - Caught exception in ScheduledExecutorService of TankerkoenigHandler. RuntimeExcetion: {}
java.lang.UnsupportedOperationException: JsonNull
    at com.google.gson.JsonElement.getAsDouble(JsonElement.java:204) [22:com.google.gson:2.3.1]
    at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigDetailResultDeserializer.deserialize(CustomTankerkoenigDetailResultDeserializer.java:43) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigDetailResultDeserializer.deserialize(CustomTankerkoenigDetailResultDeserializer.java:1) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:810) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:775) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:724) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:696) [22:com.google.gson:2.3.1]
    at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigDetailResult(TankerkoenigService.java:92) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationDetailData(TankerkoenigService.java:48) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.handler.StationHandler.updateDetailData(StationHandler.java:142) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.handler.StationHandler$1.run(StationHandler.java:92) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]
2017-09-08 13:19:09.753 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Try to refresh data
2017-09-08 13:19:09.754 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - No opening times are used
2017-09-08 13:19:09.841 [DEBUG] [ig.internal.data.TankerkoenigService] - json-String: {"ok":true,"license":"CC BY 4.0 -  https:\/\/creativecommons.tankerkoenig.de","data":"MTS-K","prices":{"fe2cb4f1-42a6-4f25-bbec-63f93a440245":{"status":"open","e5":false,"e10":false,"diesel":1.079}}}
2017-09-08 13:19:09.842 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Caught exception in ScheduledExecutorService of BridgeHandler. RuntimeException: 
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:200) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:810) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:875) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:848) [22:com.google.gson:2.3.1]
    at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigListResultDeserializer.deserialize(CustomTankerkoenigListResultDeserializer.java:56) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.internal.serializer.CustomTankerkoenigListResultDeserializer.deserialize(CustomTankerkoenigListResultDeserializer.java:1) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:810) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:775) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:724) [22:com.google.gson:2.3.1]
    at com.google.gson.Gson.fromJson(Gson.java:696) [22:com.google.gson:2.3.1]
    at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getTankerkoenigListResult(TankerkoenigService.java:79) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.internal.data.TankerkoenigService.getStationListData(TankerkoenigService.java:44) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.handler.WebserviceHandler.updateStationData(WebserviceHandler.java:142) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at org.openhab.binding.tankerkoenig.handler.WebserviceHandler$1.run(WebserviceHandler.java:100) [196:org.openhab.binding.tankerkoenig:2.2.0.201709071552]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.IllegalStateException: Expected NUMBER but was BOOLEAN
    at com.google.gson.internal.bind.JsonTreeReader.nextDouble(JsonTreeReader.java:172) ~[?:?]
    at com.google.gson.Gson$3.read(Gson.java:259) ~[?:?]
    at com.google.gson.Gson$3.read(Gson.java:253) ~[?:?]
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:103) ~[?:?]
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:196) ~[?:?]
    ... 21 more

I would prefer UnDefType.UNDEF.

I recognized another point - Could you add a toString() method for the OpeningTimes and OpeningTime classes? Thanks.

2017-09-08 13:02:20.624 [DEBUG] [.tankerkoenig.handler.StationHandler] - updateDetailData openingTimes: org.openhab.binding.tankerkoenig.internal.config.OpeningTimes@3d2b2bcc
JueBag commented 7 years ago

Thanks for this log. You did find a station which not only reports only a subset of all fuel-types (I hd found one already). However yours sticked to documented "false" in that case. Since we can't be sure that all station will comply with the documentation I'll do a check like:

           param = jsonStation.get("e10").getAsDouble();
            if (param instanceof Double) {
                final Double e10 = jsonStation.get("e10").getAsDouble();
                littleStation.setE10(e10);
            }

That way anything that is not a Double will be caugth. Note: The above code doen't give the UnDefType.UNDEF yet.

martinvw commented 7 years ago

I doubt whether that would work, are you sure it would?

Note that according to the docs getAsDouble() returns a primitive double, so most likely it will already explode with an exception before reaching the instanceof. Because the function can only return doubles nothing else not even null.

JueBag commented 7 years ago

That was the reason of my note. I'm actually searching how to do that. As I see it at the moment I migth need to change the way the channels are updated.

Actually the above code did work in case of a reported "null" and of course with correctly reported prices. However instead of Undef I got a 0 only.

cweitkamp commented 7 years ago

Just an idea: I assume the GsonBuilder serializes the null value already. You can try to check for JsonNull first. After that for JsonPrimitive and isNumber() (see http://google.github.io/gson/apidocs/com/google/gson/JsonPrimitive.html) before converting it into double. A little bit more complex, but may work.

JueBag commented 7 years ago

Thanks for that, however since the json-field should hold "false" in case of a not reported price AND the actual usage does show also "null" is used I'm actually thinking along pasing only Strings from the json and only when updating the channel checking if the String is instanceof Double, if not updating with UNDEF.

JueBag commented 7 years ago

?? On the very last part I'm hitting a wall. How can I check wether a String resembles a number?

cweitkamp commented 7 years ago

Did you check on StringUtils.IsNumeric() from Apache Commons Lang API?

JueBag commented 7 years ago

Yep, but I'm getting a NOT .IsNumeric for "1.23". I guess it's because it is language dependent and in German we would expect a "," instead of "." for the decimal seprator. I'll try it with a custom check.

cweitkamp commented 7 years ago

That's cruel. Documentation says

Checks if the CharSequence contains only Unicode digits. A decimal point is not a Unicode digit and returns false.

Meaning what? Bengali numbers are allowed, but decimals are rejected? What a joke.

I am sure you find a proper solution.

JueBag commented 7 years ago

I managed to get it with StringUtils.containsOnly. However I have a probelm with the result, although I do asign UnDefType.UNDEF and the log shows that the channel is set to UNDEF. On the control tab of PaperUI the UNDEF channel is shown as 0,000€.

JueBag commented 7 years ago

@BOFH90 Please check if that change suits your needs.

BOFH90 commented 7 years ago

I just compiled it with the increased allowed stations and installed it. I´ll report back if the error appears again. Thank you so much

JueBag commented 7 years ago

Thanks. Your request regarding the adjustable stations limit is not forgotten. IMHO such a change for ALL users of the binding needs to be cleared with Tankerkoenig. I'm waiting for a response for that part.

cweitkamp commented 7 years ago

The changes works fine for me. No errors in the log files. But I observed some strange behavior in PaperUI. The linked channels show different values. All channels are linked using PaperUI. Seems like the channel for "E10" doesn't apply the pattern to format the value. I assume it's not a binding related problem.

openhab01

JueBag commented 7 years ago

?? I was observing "unknown" in the log for all not reported prices and on the control tab always "0,000€". What did you see in the logs? Can't react until Wednesday because I'm on the road again.

cweitkamp commented 7 years ago

Take your time. I see something like this:

2017-09-10 19:52:11.889 [DEBUG] [.tankerkoenig.handler.StationHandler] - Try to refresh detail data
2017-09-10 19:52:11.981 [DEBUG] [ig.internal.data.TankerkoenigService] - getTankerkoenigDetailResult jsonData : {"ok":true,"license":"CC BY 4.0 -  https:\/\/creativecommons.tankerkoenig.de","data":"MTS-K","status":"ok","station":{"id":"fe2cb4f1-42a6-4f25-bbec-63f93a440245","name":"Raiffeisen-Landbund eG","brand":"Raiffeisen","street":"Birkenweg","houseNumber":"2","postCode":32479,"place":"Hille-Hartum","openingTimes":[],"overrides":[],"wholeDay":true,"isOpen":true,"e5":null,"e10":null,"diesel":1.099,"lat":52.3162,"lng":8.8264,"state":null}}
2017-09-10 19:52:11.982 [DEBUG] [.tankerkoenig.handler.StationHandler] - Update Tankerkoenig data 'tankerkoenig:station:a9668e57'
2017-09-10 19:52:11.982 [DEBUG] [.tankerkoenig.handler.StationHandler] - updateDetailData openingTimes: WholeDay: true/ Days: 
2017-09-10 20:01:56.879 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - Try to refresh data
2017-09-10 20:01:56.879 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - No opening times are used
2017-09-10 20:01:56.981 [DEBUG] [ig.internal.data.TankerkoenigService] - json-String: {"ok":true,"license":"CC BY 4.0 -  https:\/\/creativecommons.tankerkoenig.de","data":"MTS-K","prices":{"fe2cb4f1-42a6-4f25-bbec-63f93a440245":{"status":"open","e5":false,"e10":false,"diesel":1.099}}}
2017-09-10 20:01:56.982 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - UpdateStationData: tankstellenList.size 1
2017-09-10 20:01:56.982 [DEBUG] [nkerkoenig.handler.WebserviceHandler] - UpdateStationThings: getThing().getThings().size 1
2017-09-10 20:01:56.983 [DEBUG] [.tankerkoenig.handler.StationHandler] - Update Tankerkoenig data 'tankerkoenig:station:a9668e57'
JueBag commented 7 years ago

I'm sorry, but you posted only the log-lines with the (json) return. What would be needed are the lines which show to what the channels (e5, E10 and diesel) are set. Anything other then unknown in case of a not reported price? I looked into the code and found no difference for the channel e10. In fact all price channels are a number using the same pattern ("%0.3f €")

cweitkamp commented 7 years ago

You mean an extract of the event.log? Everything looks fine. As I said. I assume it's not a binding related problem. It's more a display problem of PaperUI. The channel-type configuration is correct. I looked into that too.

2017-09-10 19:44:20.840 [.ItemChannelLinkAddedEvent] - Link 'TESTTankstelleRaiffeisen_Diesel-tankerkoenig:station:a9668e57:diesel' has been added.
2017-09-10 19:44:28.172 [.ItemChannelLinkAddedEvent] - Link 'TESTTankstelleRaiffeisen_E10-tankerkoenig:station:a9668e57:e10' has been added.
2017-09-10 19:44:35.438 [.ItemChannelLinkAddedEvent] - Link 'TESTTankstelleRaiffeisen_E5-tankerkoenig:station:a9668e57:e5' has been added.
2017-09-10 19:52:12.067 [vent.ItemStateChangedEvent] - TESTTankstelleRaiffeisen_Diesel changed from NULL to 1.099
2017-09-10 19:52:12.068 [vent.ItemStateChangedEvent] - TESTTankstelleRaiffeisen_E10 changed from NULL to UNDEF
2017-09-10 19:52:12.069 [vent.ItemStateChangedEvent] - TESTTankstelleRaiffeisen_E5 changed from NULL to UNDEF
JueBag commented 7 years ago

Okay, your log looks like mine. Thank you for testing my changes.

JueBag commented 7 years ago

@BOFH90 Any update so far?

BOFH90 commented 7 years ago

It seems to work without any Problems. It's been stable since the last update. Thank you so much :)

Am 13.09.2017 um 11:32 schrieb Jürgen Baginski notifications@github.com:

@BOFH90 Any update so far?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

JueBag commented 7 years ago

In this case, you as the author of that issue should be able to close it. At least I think so.

martinvw commented 7 years ago

Closed 😄