Hi,
i d like to get all “warning” inside “warnings” one sensor per “warning” - the problem I have that this could be 1…n.
At the moment I address them static which can result in an error if there are no warnings at all.
How can I change the warnings[0] to a more dynamic request?
thanks
eg:
rest:
- resource: https://warnungen.zamg.at/wsapp/api/getWarningsForCoords?lon=9.661145210266115&lat=47.41094600183612&lang=de
scan_interval: 1800
sensor:- name: geosphere_warnung_1
value_template: ‘{{ value_json[“properties”][“warnings”][0][“properties”][“warntypid”]}}’
json_attributes_path: “$.properties.warnings[0].properties”
json_attributes:- begin
- end
- name: geosphere_warnung_1
API Call:
{
“type”: “Feature”,
“properties”: {
“location”: {
“type”: “Municipal”,
“properties”: {
“gemeindenr”: 30740,
“name”: “Schwechat”,
“urlname”: “schwechat”
}
},
“warnings”: [
{
“type”: “Warning”,
“properties”: {
“warnid”: 4149,
“chgid”: 6,
“verlaufid”: 2,
“warntypid”: 1,
“begin”: “27.03.2023 08:00”,
“end”: “27.03.2023 18:00”,
“create”: “2023-03-27 06:00:00+00”,
“updategrund”: “”,
“warnstufeid”: 1,
“rawinfo”: {
“wtype”: 1,
“wlevel”: 1,
“start”: “1679896800”,
“end”: “1679932800”
}
}
},
{
“type”: “Warning”,
“properties”: {
“warnid”: 4150,
“chgid”: 2,
“verlaufid”: 1,
“warntypid”: 1,
“begin”: “28.03.2023 08:00”,
“end”: “28.03.2023 18:00”,
“create”: “2023-03-27 08:00:00+00”,
“updategrund”: “”,
“warnstufeid”: 1,
“rawinfo”: {
“wtype”: 1,
“wlevel”: 1,
“start”: “1679983200”,
“end”: “1680019200”
}
}
}
]
}
}
2 posts - 2 participants