Webview to DarkSky "Refused to connect" // OH 2.5.2 bad HTTP Headers problem?

For some time I have been using a WebView (like the one below) to display the local DarkSky weather forecast in my Sitemap UI. And until about one month ago, it was working perfectly. However of late I am getting a “darksky.net refused to connect” message.

The given URL still works fine in a browser, but it does not work anymore in the Sitemap frame.

I think the problem may have started with the migration from OH 2.5.0 to OH 2.5.2, and I am wondering if the problem is that OH has started sending different HTTP Headers (e.g. User-Agent) in its HTTP GET request, which darksky.net does not accept. => Does anyone know how to tweak the OH HTTP headers so that this will work again?

Webview icon="none" url="https://darksky.net/forecast/12.1234,12.1234/ca12/en" height=53

Hello Andrew,

The way i use darksky widgets is like this:

html file in conf/html:

<html>
<script type='application/javascript' src='https://darksky.net/widget/default/52.3011,5.6231/ca12/nl.js?width=100%&height=350&title=Weather&textColor=ffffff&bgColor=transparent&transparency=true&skyColor=undefined&fontFamily=Default&customFont=&units=ca&htColor=ffffff&ltColor=b2b2b2&displaySum=yes&displayHeader=yes'></script>
</html>

Just copy the code darksky gives you between the html code.

Then in sitemap put this:

Webview url="http://openhab:8080/static/weather.html" icon=none height=11

So change the url to your pi’s url and put in the file name of the HTML file

Hi @brizzik many thanks for your suggestion. It works perfectly!

1 Like

No problem @AndrewFG

Glad to help.

1 little tip, if you use the openhab cloud when out of home the picture wont work. Maybe it did before when you used the direct url.

I overcame that problem by turning the picture off when my presence is off. With the visibility option in sitemap, keeps it more clean

{Webview url="http://openhab:8080/static/weather.html" icon=none height=11 visibility=[Presence==ON] }

Hi @brizzik thanks for the tip about visibility; personally I don’t use cloud access, so it’s not really an issue for me; but many thanks anyway.