Hi,
I’m trying to use the HACS mutliscrape integration to get some data into sensors. I have managed to retrieve the whole JSON, but cannot figure out how to use value_json in templates properly. Are there any docs?
In particular the part of the JSON I want looks like this:
{
"current": {
"fromDateTime": "2022-03-29T12:10:55.843Z",
"tillDateTime": "2022-03-29T13:10:55.843Z",
"values": [
{
"name": "PM1",
"value": 13.74
},
{
"name": "PM25",
"value": 21.99
},
{
"name": "PM10",
"value": 30.03
},
{
"name": "PRESSURE",
"value": 1009.85
},
{
"name": "HUMIDITY",
"value": 61.52
},
{
"name": "TEMPERATURE",
"value": 15.23
},
{
"name": "SO2",
"value": 1.84
},
{
"name": "CO",
"value": 424.65
}
],
I want to get e.g. the value
associated with the name
PM1, 13.74. I think the problem is that the value key is a list. I’ve tried something like
value_template: "{{value_json.current.values[0].value}}"
and various others iterations but I always get the error that
* Template variable error: builtin_function_or_method object has no element 0 when rendering '{{ value_json.current.values[0].value }}'
Could someone help?