I am trying to get alerts from wunderground (forecast and conditions are working well)
However, the rersponse looks different and I am struggling with two things:
- getting the alerts in german language and
- putting the result into items
http service looks like this:
http://api.wunderground.com/api/your_key/alerts/q/zmw:00000.1.16172.json
Alternatively I tried also without luck:
http://api.wunderground.com/api/your_key/alerts/lang:DL/units:metric/q/zmw:00000.1.16172.json
Response looks always (regardless of the used string) like this:
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"alerts": 1
}
}
,"query_zone": "999",
"alerts": [
{
"type": "HEA",
"wtype_meteoalarm": "5",
"wtype_meteoalarm_name": "Extreme high temperature",
"level_meteoalarm": "2",
"level_meteoalarm_name": "Yellow",
"level_meteoalarm_description": "The weather is potentially dangerous. The weather phenomena that have been forecast are not unusual, but be attentive if you intend to practice activities exposed to meteorological risks. Keep informed about the expected meteorological conditions and do not take any avoidable risk.",
"description": "Potential disruption due to extreme high temperatures from 12PM CEST THU until 4:30PM CEST THU",
"date": "2017-06-22 01:00:00 GMT",
"date_epoch": "NA",
"expires": "2017-06-22 14:30:00 GMT",
"expires_epoch": "NA",
"message": "Potential disruption due to extreme high temperatures from 12PM CEST THU until 4:30PM CEST THU)",
"phenomena": "NA",
"significance": "NA",
"attribution": "Information provided by , <a href='http://meteoalarm.eu/'>EUMETNET - MeteoAlarm</a> Note: Time delays between this website and <a href='http://meteoalarm.eu/'>Meteoalarm.eu</a> are possible. For the most up-to-date information about alert levels as published by the participating National Meteorological Services, please visit <a href='http://meteoalarm.eu/'>Meteoalarm</a>. For terms of use of this information, and copyright information, see <a href='http://meteoalarm.eu/'>Meteoalarm</a> Terms of Use."
}
]
}
What I am trying to read is for instance the type, the level or the message (if possible in German ) so I set up items like:
String vWeather_Type "Unwetterart [MAP(wu_alarms_code.map):%s]" <typ> (gWeatherH) { http="<[weatherAlerts:420000:JSONPATH($.alerts.alert.type)]" }
Number vWeather_Meteoalarm "Alarmcode [MAP(wu_alarms_code.map):%s]" <alarmcode> (gWeatherH) { http="<[weatherAlerts:420000:JSONPATH($.alert.wtype_meteoalarm)]" }
However, I am failing with the correct items definition, Using the examples above is forcing the server to hang
If I take a look at the response I see the -->[ <-- sign which can imho not be parsed correctly wihtin my item definition.
"alerts": [
Someone can give me a hint?