2020-07-09 21:40:09.798 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.IllegalArgumentException: Illegal character in scheme name at index 0: "https://api.github.com/repos/arendst/Tasmota/tags"
at java.net.URI.create(URI.java:852) ~[?:1.8.0_222]
at org.eclipse.jetty.client.HttpClient.newRequest(HttpClient.java:442) ~[?:?]
at org.openhab.binding.http.internal.http.RefreshingUrlCache.refresh(RefreshingUrlCache.java:79) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_222]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_222]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 0: "https://api.github.com/repos/arendst/Tasmota/tags"
at java.net.URI$Parser.fail(URI.java:2848) ~[?:1.8.0_222]
at java.net.URI$Parser.checkChars(URI.java:3021) ~[?:1.8.0_222]
at java.net.URI$Parser.checkChar(URI.java:3031) ~[?:1.8.0_222]
at java.net.URI$Parser.parse(URI.java:3047) ~[?:1.8.0_222]
at java.net.URI.<init>(URI.java:588) ~[?:1.8.0_222]
at java.net.URI.create(URI.java:850) ~[?:1.8.0_222]
... 9 more
Ps.: My bad, I had a look at the exception again and the problem was in the base url, I forgot to delete the quotation marks, it works now!
I’m using PaperUI. Anyway the config is really straightforward.
Define the BaseURL at thing level and add state transform for a channel as you would do in MQTT2 binding.
So state transform should look like this (assuming a json input):
Thanks for bringing that up!
Yes it was really annoying and it not even showed these errors between the specified poll intervals but every few seconds… @J-N-K
I think an UNDEF state for channels on a Thing is great for showing unreachable hosts. Maybe also use ThingStatus to represent availability on a Thing level?
The config per channel might be an option. lastReadSuccess is difficult, because it could be that reading one channel is successfull (e.g. with one stateExtension) while another channel (with another stateExtension) always fails. The lastReadSuccess would not help here.
Really I was thinking this would be a built-in channel exposing something about the Thing. It’s the Thing doing the HTTP work from the user viewpoint.
I see this binding does both read and write - so I suppose a better name might be more like lastCommSuccess lastCommError
or something if it covers both uses.
Maybe it is less useful these days where Thing status is more accessible from rules, if this Thing reflects its comms problems in its own status…
But no matter what I try all I always get is a server response </CGI_Result>-2</CGI_Result>
The debug output is mostly useless as it does not show the URL or headers going out, not even info like SSL or user auth, or responses coming back.
All debug level log shows is
2020-07-10 17:09:30.119 [DEBUG] [.transform.SingleValueTransformation] - Transformation ChannelStateTransformation{pattern='.*?<motionDetectAlarm>(.*?)</motionDetectAlarm>.*', serviceName='REGEX'} returned empty result when applied to <CGI_Result>
<result>-2</result>
</CGI_Result>
.
I was able to confirm this is what the server returns using wireshark, but for sure I need to be able to see that in the OH log to be able to make good use of it.
I have updated the link above. If you set org.openhab.binding.http.internal.http to TRACE you’ll see the URL when requesting and the responses received.
Dowloaded it but did that change anything about http logging ?
That’s not really useful yet. Would need to see Headers, body and reponse code of the request
2020-07-10 20:24:04.590 [TRACE] [ttp.internal.http.RefreshingUrlCache] - Sending 'http://foscam:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState' to 'HttpRequest[GET /cgi-bin/CGIProxy.fcgi HTTP/1.1]@13442bb'
2020-07-10 20:24:04.639 [TRACE] [ttp.internal.http.RefreshingUrlCache] - RefreshingUrlCache for 'http://foscam:88/cgi-bin/CGIProxy.fcgi?cmd=getDevState' received 'org.openhab.binding.http.internal.http.Content@66d12b'
It does, thanks.
It helped me find my own error now that I see the 200 response.
Turned out it was the request I didn’t copy properly. That device needs to have http://host/yaddayadda&usr=username&pwd=password rather than basic auth.
What’s left is that apparently I must be having another HTTP thing active (resulting from first tests yesterday ?) as I keep seeing both URLs below (the difference is the additional ‘/’). I don’t find that 2nd one in the list of smarthome:things though - is it something your binding does ? (although I don’t think so as it has a different request interval).
But that reminds me of this: if I’m not mistaken, you add State and Command URL Extension to Base URL but insert a fixed ‘/’, correct?
Then please remove that fixed ‘/’ insertion as the requirement could as well be to continue the URL with ? or & like in my test case.