@tk161900 wrote:
Hi. I’m trying to extract the value from some JSON at a URL. I am able to get some of the contents to display in Home Assistant, but the values from the array in the JSON (which is what I am really after) displays as unknown.
For instance at this URL:
https://waterservices.usgs.gov/nwis/iv/?sites=05514705&period=P7D&format=json
I want to retrieve the latest river gage level.
This path returns the correct value in this JSONTesterr:
.value.timeSeries[0].values[0].value[667].value
So I would think that
{{ 'value_json.value.timeSeries[0].values[0].value[667].value' }}
would return the same value, but nope. I have been working on this for a few days with no luck. I would really like to do this natively in Home Assistant without invoking BeautifulSoup if possible. Any suggestions?Here is my REST sensor setup:
- platform: rest name: quivre resource: https://waterservices.usgs.gov/nwis/iv/?sites=05514705&period=P7D&format=json value_template: '{{ value_json.value.timeSeries[0].values[0].value[667].value }}' verify_ssl: false
Posts: 7
Participants: 4