Openhab.binding.weather & Meteoblue API

Der API-Request fuer Meteoblue funktioniert nicht für “basic-day”, also die kostenlose Abfrage der Meteoblue-API.

Ich habe mir das mal angesehen.

Im Code “src/main/java/org/openhab/binding/weather/internal/provider/MeteoBlueProvider.java” steht folgenden URL.

private static final String URL = "http://my.meteoblue.com/dataApi/dispatch.pl?apikey=[API_KEY]&type=json_7day_3h_firstday&lat=[LATITUDE]&lon=[LONGITUDE]&temperature=C&windspeed=ms-1&winddirectio
    n=degree&precipitationamount=mm&format=json";

Der OutPut mit einem validen API-Key lautet dann,

{
	"error_message": "MB_REQUEST::DISPATCH: This datafeed is not authorized for your api key", 
	"info": "Need help? Please contact info@meteoblue.com and provide this information"
}

Der valide Request zum passenden API-Key, laut Meteoblue lautet jedoch,

http://my.meteoblue.com/packages/basic-day?apikey=[API_KEY]&lat=[LATITUDE]&lon=[LONGITUDE]&asl=32&tz= Europe%2FBerlin&&city=[LOCATION]

Das Ergebnis wuerde dann so aussehen.

{
	"metadata": 
	{
		"name": "", 
		"latitude": 52.45, 
		"longitude": 13.57, 
		"height": 32, 
		"timezone_abbrevation": "CET", 
		"utc_timeoffset": 1.00, 
		"modelrun_utc": "2017-02-21 00:00", 
		"modelrun_updatetime_utc": "2017-02-21 07:26"
	}, 
	"units": 
	{
		"time": "YYYY-MM-DD hh:mm", 
		"predictability": "percent", 
		"precipitation_probability": "percent", 
		"pressure": "hPa", 
		"relativehumidity": "percent", 
		"temperature": "C", 
		"winddirection": "degree", 
		"precipitation": "mm", 
		"windspeed": "ms-1"
	}, 
	"data_day": 
	{
		"time": ["2017-02-21", "2017-02-22", "2017-02-23", "2017-02-24", "2017-02-25", "2017-02-26", "2017-02-27"], 
		"pictocode": [12, 12, 12, 11, 12, 12, 12], 
		"uvindex": [1, 0, 0, 1, 1, null, null], 
		"temperature_max": [8.05, 10.02, 10.53, 5.38, 9.47, 9.76, 13.00], 
		"temperature_min": [5.05, 4.34, 4.26, 2.02, 0.70, 5.97, 5.98], 
		"temperature_mean": [7.44, 7.45, 6.53, 3.89, 5.00, 7.85, 9.37], 
		"felttemperature_max": [3.67, 3.42, 5.45, -2.39, 2.54, 1.57, 6.60], 
		"felttemperature_min": [0.68, -2.18, -5.06, -6.30, -5.42, -2.67, 0.65], 
		"winddirection": [270, 270, 270, 270, 225, 270, 225], 
		"precipitation_probability": [96, 93, 99, 61, 85, 85, 40], 
		"rainspot": ["1221211122111112121112222111222221122111112111112", "3333333333333333333333333333333333333333333333333", "3333333333333333333333333333333333333333333333333", "2322222232233323233332233333333323333333332322322", "3333333333333333333333333333333333333333333333333", "2222222122222222222322222222222222222223322223322", "1111111111111111111111111111111111211111111112121"], 
		"predictability_class": [4, 3, 3, 2, 3, 2, 2], 
		"predictability": [66, 54, 46, 35, 48, 32, 22], 
		"precipitation": [2.17, 8.88, 7.18, 5.94, 6.17, 4.90, 0.90], 
		"snowfraction": [0.00, 0.00, 0.00, 0.38, 0.00, 0.00, 0.00], 
		"sealevelpressure_max": [1010, 1009, 1000, 1003, 1008, 1010, 1008], 
		"sealevelpressure_min": [1005, 997, 985, 988, 994, 994, 1003], 
		"sealevelpressure_mean": [1007, 1000, 993, 997, 1002, 1002, 1005], 
		"windspeed_max": [7.91, 9.20, 12.38, 12.98, 11.30, 12.71, 8.94], 
		"windspeed_mean": [6.32, 7.12, 7.15, 8.43, 7.87, 10.15, 7.05], 
		"windspeed_min": [3.60, 3.01, 3.16, 4.88, 5.56, 4.94, 4.15], 
		"relativehumidity_max": [92, 95, 94, 92, 95, 90, 93], 
		"relativehumidity_min": [75, 76, 66, 67, 81, 81, 75], 
		"relativehumidity_mean": [85, 85, 84, 82, 90, 86, 86], 
		"convective_precipitation": [0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00], 
		"precipitation_hours": [4.00, 8.00, 6.00, 5.00, 6.00, 5.00, 1.00], 
		"humiditygreater90_hours": [6.00, 7.00, 4.00, 1.00, 12.00, 0.00, 9.00]
	}
}
```

Hi keule,

Yesterday I realized the same issue. I uninstalled the weather binding, download the sources, correct the URL for MeteoBlue, and run mvn clean install on the weather binding. I put the new jar file in the addons folder (/usr/share/openhab2/addons on my openhabian). Now the weather data are fetched from MetroBlue, but are not parsed correctly:

2017-02-25 17:12:53.915 [WARN ] [nternal.parser.AbstractWeatherParser] - METEOBLUE: Error setting property ‘units.precipitation_probability’ with value ‘percent’ and converter INTEGER
2017-02-25 17:12:53.918 [WARN ] [nternal.parser.AbstractWeatherParser] - METEOBLUE: Error setting property ‘units.temperature’ with value ‘C’ and converter DOUBLE

Although it is only a warning, my weather items were not updated. I don’t know, what to do know. I’m not a java guy.

Hi, I ran into the same problem. Opened a request here:

Hi community
I try to use the weather binding with data from meteoblue. I have installed the binding an
configured it, but now thers is the following error in the log-file.

METEOBLUE[home]: Can't retreive weather data: MB_REQUEST::DISPATCH: This datafeed is not authorized for your api key

I have an API-Key for Basic-Day-Package (for free)
This problem is also described above, but I can not figure out how to solve it. Is there a new
version of the binding to solve this problem available?

Openhab Version “2.3.0”
Weather Binding Version “binding-weather1 - 1.12.0”

Thanks for your tips

If you had read the link above your post, you would already know the answer.

many thanks for the answer. I had read the entries and links above and saw that a correction was made. but I’m not sure if the correction for openhab 2 was made and where I can download the corrected Binding.

I still had no contact with git and I would be grateful for a tip

You’ve misunderstood. There has been no correction made. The existing OH1 weather binding only uses the commercial API for Meteoblue.
The new ESH binding that is being developed will, at least theoretically, use either. But it is not yet finished/published.

Hello,

maybe this is not the best thread but it is related to Meteoblue. I need a sun-hours forecast for the next days.

I’m living off-grid in Patagonia, Chile and I need to charge my battery with a electric generator if the next day has less than 2 hours of sunshine:

if( BatteryVolt<24.2 && Sun_Hour<2 ) then turn Generator( On ).

Does anyone knows where I can retrieve a sun-hour (sunshine) forecast for the next days? I already managed to retrieve sun-hours from MeteoGroup but it is getting very inaccurate (maybe global weather changes?).

Any help or information is appreciated.