Hello everyone, im currently trying to set up a REST custom sensor, which returns a json string. To read the json response I need to configure my REST template. My json response: {"diskusage":"50%","ramusage":"2246","cpuload":"7%","cputemp":"54.04"} My Template right now:
{ "prtg": { "result": [ { "Channel": "ramusage", "CustomUnit": "gb", "Float": 1, "Value": $.ramusage }, { "Channel": "cputemp", "CustomUnit": "°C", "Float": 1, "Value": $.cputemp }, { "Channel": "diskusage", "CustomUnit": "%", "Value": $.diskusage }, { "Channel": "cpuload", "CustomUnit": "%", "Value": $.cpuload } ] } }
Which works perfectly fine for my Integer/ Float values. But for "diskusage" and "cpuload" I get an error. Because value only accept Integers/ Floats but not string.
My Solution would be to cut off the "%" of the 2 values to "convert" it into a Float. But how do I do that? Is there any better way to do this?
Add comment