Hi there,
at first, I’m sorry, I tend to forget about configuring OH2 with PaperUI (I solely use files… #oldfashioned).
So let’s do this:
Weather Underground delivers an API with a pretty good JSON response. The WeatherUnderground binding takes the JSON, makes some channels and throws is back in for using.
I don’t use the binding (I’ll tell you, what I do later on), so I don’t know exactly, whether all JSON-Attributes are taken 1:1 as channels (but my bet is it should do).
- at first you can define in your WU-Profile (Member Settings - Page Preferences) your units (metric) and language (german)
- if you configure “German” in PaperUI I guess it already sets the right Country Code (http://api.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1)
- I don’t know, what else the WU-Binding has as channel, but if
current#icon
has the whole URL to the icon, you can either strip the sole icon name. i would have expected current:icon
and current:icon_url
as channels.
- you can now make your items with the use of the WU-channels
So, you asked on how you can see the JSON-response. that’s pretty straightforward. As you already know your API-key, just klick on this (of Course using your credentials ):
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"conditions": 1
,
"forecast": 1
}
}
, "current_observation": {
(...)
"precip_today_in":"0.00",
"precip_today_metric":"0",
"icon":"cloudy",
"icon_url":"http://icons.wxug.com/i/c/k/cloudy.gif",
(...)
}
As you can also see, there are a lot more attributes here like “precip_today_in” and “precip_today_metric” - so, the binding makes it easier for you to use those in your units.
And that’s basically, what I do: taking the JSON and parsing it for my wanted items.
My experience is, with the configuration in the WU-Profile to metric and german plus the “DL” argument in the API-URL you get metric units in texts ("fcttext_metric":"Teilweise bedeckt. Tiefsttemperatur 3C. Wind aus SSW mit 15 bis 25 km/h."
). The Binding can only use the “DL” argument, so it could be, that there’s only imperial units in german texts. AFAIR that was what I got before changing the values in the profile.
next thing you need to know using weather-underground: take a closer look to the JSON, you will see, that you get a bunch of information with $current_observation
, that’s the current#...
channels in the binding. Then you get two periods for today in the forecast, which represent day
and night
for today, thats forecastToday:...
channels. I don’t know, where the night-attributes go… but then you get the rest like forecastTomorrow forecastDay2 … forecastDay9
- again, I don’t know where the night-attributes of the next days go (they’re present in the JSON):
{
"period":2,
"icon":"partlycloudy",
"icon_url":"http://icons.wxug.com/i/c/k/partlycloudy.gif",
"title":"Dienstag",
"fcttext":"Teilweise bedeckt. Höchsttemperatur 50F. Wind aus SW mit 15 bis 25 mph.",
"fcttext_metric":"Teilweise bedeckt. Höchsttemperatur 10C. Wind aus SW mit 25 bis 40 km/h.",
"pop":"10"
}
,
{
"period":3,
"icon":"nt_clear",
"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",
"title":"Dienstag Nacht",
"fcttext":"Meistens klar. Tiefsttemperatur 35F. Wind aus SSW mit 10 bis 20 mph.",
"fcttext_metric":"Meistens klar. Tiefsttemperatur 2C. Wind aus SSW mit 15 bis 30 km/h.",
"pop":"10"
}
So, I hope, that clears it - have fun! and merry christmas (watching my son playing around with the PS4 and Star Wars Battlefront II)