Hello,
I’m trying to extract a value from some JSON output. The output looks like this - I have removed some of the result part as its quite long:
{
"ActTime" : 1475479301,
"ServerTime" : "2016-10-03 08:21:41",
"Sunrise" : "07:13",
"Sunset" : "18:39",
"result" : [
{
"Humidity" : 98,
"HumidityStatus" : "Wet",
"Temp" : 4.80,
"Type" : "Temp + Humidity",
"TypeImg" : "temperature",
"idx" : "3698"
}
],
"status" : "OK",
"title" : "Devices"
}
If I have a sensor like this I get the sunrise returned correctly:
- platform: rest
resource: http://192.168.1.110:8080/json.htm?type=devices&rid=3698
value_template: '{{ value_json.Sunrise }}'
method: GET
name: Test
unit_of_measurement: "°C"
However I want to get the Temp out of the result section, if I try this I get nothing:
- platform: rest
resource: http://192.168.1.110:8080/json.htm?type=devices&rid=3698
value_template: '{{ value_json.result.Temp }}'
method: GET
name: Outside
unit_of_measurement: "°C"
If I change the value_template to the following I get everything in result:
value_template: '{{ value_json.result }}'
How do I extract just the Temp value?
Thanks.