The swedish weather service have a json with weather alerts where there are lots of alerts that looks like this:
{
"alert": [
{
"identifier": "smhi-bpm-1564025849412",
"sender": "[email protected]",
"sent": "2019-07-25T05:55:21+02:00",
"status": "Actual",
"msgType": "Alert",
"scope": "Public",
"code": [
"system_affiliation 5",
"latest_update 2019-08-07T22:56:41+02:00",
"system_version 30",
"system_alert_category risk"
],
"info": {
"language": "sv-SE",
"category": "Met",
"event": "fire warning",
"urgency": "Expected",
"severity": "Severe",
"certainty": "Possible",
"eventCode": [
{
"valueName": "system_event_level",
"value": "Risk Forest fire"
},
{
"valueName": "system_event_sv-SE",
"value": "Brandvarning"
},
{
"valueName": "system_event_priority",
"value": 0
},
{
"valueName": "system_event_level_sv-SE",
"value": "Risk Skogsbrand"
},
{
"valueName": "system_event_level_color",
"value": "#ab56ac"
},
{
"valueName": "system_event_level_id",
"value": 4
}
],
"effective": "2019-07-25T05:55:21+02:00",
"onset": "2019-07-25T05:55:21+02:00",
"expires": "2020-07-24T05:37:29+02:00",
"senderName": "SMHI, Swedish Meteorological and Hydrological Institute",
"headline": "VÀsterbottens lÀn kustland",
"description": "NÀr: Torsdag\nVar: I hela omrÄdet\nIntensitet: Risken för brÀnder i skog och mark Àr mycket stor eller extremt stor\nKommentar: -",
"web": "http://www.smhi.se/vadret/vadret-i-sverige/Varningar",
"parameter": [
{
"valueName": "system_position",
"value": 1
},
{
"valueName": "system_history",
"value": "{\"history\":[{\"date\":\"2019-07-: -\"}]}"
},
{
"valueName": "system_eng_headline",
"value": "VÀsterbottens lÀn kustland"
},
{
"valueName": "system_eng_description",
"value": "When: Thursday\nWhere: In the whole area\nIntensity: The risk of fires in forest and land is very high or extremely high\nComment: -"
},
{
"valueName": "system_backward_information_reference",
"value": "smhi-bpm-1563938982343;1"
}
],
"area": {
"areaDesc": "033"
}
}
}, etc. a bunch more like the above.
}
]
}
Can I somehow in the value template use a if
value to only select the alerts where AreaDesc
is one that I select⊠they have each area in a separate json for some reason!
I was thinking something like this?
{% if value("areaDesc", "033") -%}
json_attributes
- eventCode
{%- else -%}
No Warnings
{%- endif %}