RESTful Sensor

Hello i’m new here…
How can i extract the temperature off this string?

{
  "variable": {
    "name": "TempQnap.temperature",
    "readonly": true,
    "type": "attribute",
    "value": 47,
    "unit": "°C"
  },
  "success": true
}

thanks
Chris

Try something like:

value_template: '{{ value_json.variable.value }}'

1 Like

Thanks,
in short:
SOLVED… :slight_smile:

mfg
Chris

I’d like to buy the man who thought of value and sensor templates a beer. :beer: I keep finding uses for them and learning new ones.

But they do seem to have an impact, especially when initializing after a restart. Are there any best practices for using things like template sensors like a maximum number or should they load before or after other sensors? I just would like to know if they have any negative impacts on performance or anything.

Hi!

I have also problem parsing values…

{
“ActTime” : 1487175309,
“result” : [
{
“AddjMulti” : 1.0,
“AddjMulti2” : 1.0,
“AddjValue” : 0.0,
“AddjValue2” : 0.0,
“BatteryLevel” : 100,
“CustomImage” : 0,
“Data” : “7.6 C, 46 %”,
“Description” : “”,
“DewPoint” : “-3.29”,
“Favorite” : 0,
“HardwareID” : 2,
“HardwareName” : “rflink”,
“HardwareType” : “RFLink Gateway USB”,
“HardwareTypeVal” : 46,
“HaveTimeout” : false,
“Humidity” : 46,
“HumidityStatus” : “Comfortable”,
“ID” : “DD01”,
“LastUpdate” : “2017-02-15 17:10:51”,
“Name” : “Außensensor Garten”,
“Notifications” : “false”,
“PlanID” : “0”,
“PlanIDs” : [ 0 ],
“Protected” : false,
“ShowNotifications” : true,
“SignalLevel” : “-”,
“SubType” : “WTGR800”,
“Temp” : 7.60,
“Timers” : “false”,
“Type” : “Temp + Humidity”,
“TypeImg” : “temperature”,
“Unit” : 0,
“Used” : 1,
“XOffset” : “0”,
“YOffset” : “0”,
“idx” : “1”
}
],
“status” : “OK”,
“title” : “Devices”
}

I tried…

value_template: ‘{{ value_json.result.data }}’
value_template: ‘{{ value_json.result.[].data }}’
value_template: ‘{{ value_json.result.[0].data }}’
value_template: ‘{{ value_json.result.Data }}’

The value above are result from domoticz…
bg
Raimund

@piffmasta Did you figure out the parsing on this one?

Yes. Working with jq or nodejs over commandline parsing values… curl xxx | jq xxxx