Dark Sky - Yawb4oH2 (Yet another weather binding for openHAB 2)

Dark Sky (formerly known as Forecast.io):

  • 1000 API calls free per day
  • current weather including UV Index and Ozone
  • minute-by-minute (max. 60 min), hour-by-hour (48 or 168 hours) and day-by-day (max. one week) forecasts
  • weather alerts in the US, Canada, European Union member nations, and Israel
  • 39 different languages (and the possibility to contribute more translations)

I finally ported my work to OH2 and got it working again. At least with latest snapshot version (2.5.0 Build 1552). I will not provide support for OH2 release version 2.4.0. A test version is linked in GitHub. I will upload it to Eclipse Marketplace later.

The binding is nearly similar to the OpenWeatherMap binding. I need to adopt some more parts of the code to the latest version. It currently provides some features which will be removed before it will enter the OH2 Add-ons repository (e.g. sunrise and sunset trigger).

Have a look at the documentation documentation for a minimal example.

The API supports weather alerts which currently should be available in the USA, Canada, European Union member nations, and Israel. I could not manage to receive an alert even if one of their sources is DWD. It will be very much appreciated if someone can send me valid responses. Thanks.

// CC @mhilbush @sihui @V69 @ariela @michaeljoos @kjunker @OhNoItSJoe @fex



I’m currently using Dark Sky with the weather1 binding. I would like to switch to your binding.

I also use the nice widget from the weather1 documentation.


In the documentation mentioned above, there is a file named example.html, which contains the OH1 channels. (used as TOKENS)

How can I continue to use this with the new binding?

Is it just a replacement of the OH1 channels with the OH2 channels?

see following example.html:

<!DOCTYPE html>
	<meta http-equiv="Content-type" CONTENT="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="weather-data/layouts/example.css" />
	<script type="text/javascript" src="weather-data/layouts/example.js"></script>

<body id="weather-body" onload="formatIframe()">
<div id="weather-location-name">${config:name}, ${weather:condition.observationTime(%1$td.%1$tm.%1$tY %1$tH:%1$tM)}</div>

<table id="weather-table">
		<td rowspan="2"><img id="weather-icon" src="weather-data/images/${param:iconset}/${weather:condition.commonId}.png"/></td>
		<td id="weather-temp">${weather:temperature.current(%.1f)}</td>
		<td id="weather-temp-sign">°C</td>
		<td colspan="2">
			<table id="weather-table-details">
					<td>${weather:atmosphere.humidity} %</td>
					<td>${weather:atmosphere.pressure(%.1f)} mb</td>

<table id="weather-forecast-table">
		<td><img src="weather-data/images/${param:iconset}/${forecast(0):condition.commonId}.png"/></td>
		<td><img src="weather-data/images/${param:iconset}/${forecast(1):condition.commonId}.png"/></td>
		<td><img src="weather-data/images/${param:iconset}/${forecast(2):condition.commonId}.png"/></td>
		<td class="temp-max">${forecast(0):temperature.max(%.0f)}</td>
		<td class="temp-max">${forecast(1):temperature.max(%.0f)}</td>
		<td class="temp-max">${forecast(2):temperature.max(%.0f)}</td>
		<td class="temp-min">${forecast(0):temperature.min(%.0f)}</td>
		<td class="temp-min">${forecast(1):temperature.min(%.0f)}</td>
		<td class="temp-min">${forecast(2):temperature.min(%.0f)}</td>



Could it be something like this, e.g:

weather1 Tokens possible DarkSky OH2 Tokens
${config:name} ??
${config:latitude} ??
${config:longitude} ??
${weather:condition.commonId} ${ channel=“darksky:weather:api:local:current#condition” }
${weather:atmosphere.humidity} ${ channel=“darksky:weather:api:local:current#humidity” }
${weather:atmosphere.pressure(%.1f)} ${ channel=“darksky:weather:api:local:current#pressure” }
${weather:temperature.current(%.1f)} ${ channel=“darksky:weather:api:local:current#temperature” }
${weather:condition.observationTime (%1$td.%1$tm.%1$tY %1$tH:%1$™)} ${ channel=“darksky:weather:api:local:current#time-stamp” }
${forecast(0):condition.commonId} ${channel=“darksky:weather:api:local:forecastTomorrow#condition” }
${forecast(1):condition.commonId} ${ channel=“darksky:weather:api:local:forecastDay1#condition” }
${forecast(2):condition.commonId} ${ channel=“darksky:weather:api:local:forecastDay2#condition” }
${forecast(0):temperature.max(%.0f)} ${ channel=“darksky:weather:api:local:forecastTomorrow#max-temperature” }
${forecast(1):temperature.max(%.0f)} ${ channel=“darksky:weather:api:local:forecastDay1#max-temperature” }
${forecast(2):temperature.max(%.0f)} ${ channel=“darksky:weathe:api:local:forecastDay2#max-temperature” }
${forecast(0):temperature.min(%.0f)} ${ channel=“darksky:weather:api:local:forecastTomorrow#min-temperature” }
${forecast(1):temperature.min(%.0f)} ${ channel=“darksky:weather:api:local:forecastDay1#min-temperature” }
${forecast(2):temperature.min(%.0f)} ${ channel=“darksky:weather:api:local:forecastDay2#min-temperature” }
${param:iconset} ${param:iconset}

Hi Alex,

I am afraid it will not be possible. AFAIK the weather1 binding provides a WebServlet which handles the widget feature including replacement of placeholders and so on. I am not sure if such thing is possible with OH2 resources.


Would it be possible to code such a feature in DarkSky binding or Openweathermap binding.

Then switching from weather1 to your OH2 bindings would be easier for many weather1 users! :slight_smile:

Yes, after a very quick research I think it is. We e.g. already have some bindings which implements a HttpServlet to support some binding related API calls. I will give it a try.



Any news on this?


First of all thx for the great work your doing. Just found your binding during search for a wunderground alternative. Very happy that as an ex-wunderground user i dont have to change a lot so it works (regarding to items). But i encountered a problem: Formatting “current#precip-probability” (in this case %.1f) doesn’t work - also i saw via Rest-api that the item is set as “readonly=true” (all others not), maybe this is the reason why? A other thing is like you describe on github station id, name and location: do they exist? For me they don’t work (from where do they come? The json of darksky as far is i saw does not provide this). And last question: Are things like “apparentTemperature or dewpoint” accessible? they appear in the json but are not on your list/not working for me with this name. If not would it be possible to add them?

No, not yet. Time is limited.

Good news are: The binding has been merged and is part of OH 2.5.0 snapshot 1566.

@maxwie1093 Please have a look at the new official documentation. The precipitation probability is a percentage value which should be formatted with “%d”.

Number:Dimensionless localCurrentPrecipitationProbability "Current precipitation probability [%d %unit%]" <rain> { channel="darksky:weather-and-forecast:api:local:current#precip-probability" }

Just for clarification. All of the channels should be readonly. You cannot change them, only read them.

The station stuff has been removed because it is not part of the binding.

“apparentTemperature” or “dewpoint” are not yet accessible via the binding but it should be possible to add them. Feel free to come up with an enhancement PR for it.

I installed the binding ( on OH S1566, but when trying to create a managed Thing, there is nothing to select (no errors). [Edit… I can’t explain why, but I looked again, and they showed up! Something took a while.]

After setting this up, I’m wondering why the minimum refresh interval is 10 minutes. If the binding is only making one API call, we should be able to use 2 minutes as the minimum and still use a free API key. But if I have a paid account, why not let me set it even more frequently?

Yes, the registries sometimes need a little bit to get refreshed.

To be honest I din not really think about what is the right minimum refresh interval. I do not mind to change it.

1 Like

Do you have it handy in your IDE, or would you like a PR?

I probably won’t have time to change it before Sunday. PR is appreciated.

1 Like

How can I get this addon downloaded and installed on a docker image?

Use the “latest” tag for the docker image, then you should get the addon included. That’s what I do anyways :slight_smile:

I tried that and I still do not get it at all.

Hi @Robert_Burgess,

You can download the latest version here. But be aware of the fact that it will not work with an older OH2 version because of not available dependencies. Minimum is OH 2.5.0 snapshot 1566.

Hi, I tried your binding in last snapshot, works great. One value I would like to see is WindGust. Possible to add? Have this in my vera: CurrentWindGust. Thanks.

i use OH2.5 M1

Binding do not work

Here is te Log:

2019-06-16 09:49:08.698 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.darksky-2.5.0-SNAPSHOT.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.darksky [279]

Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]

at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

Did you read one post above? it says: Minimum is OH 2.5.0 snapshot 1566

oh yes, who can read is in the advantage!