Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106117

Rest API Call - get all element from a dynamic array

$
0
0

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:

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

Read full topic


Viewing all articles
Browse latest Browse all 106117

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>