It should be possible. You can make 2 template sensors (either via yaml or via helpers). I use rest calls and command line calls to pull data for all kinds of things, like crypto and stock prices, local gas station prices, etc. This is the type of thing I consult AI for to get a baseline of the yaml code I’d need. I’d share it, but unfortunately using/sharing AI code on this forum is banned. I recommend you ask ChatGPT, Grok, etc. Let it know you’re using a rest sensor and paste the results exactly as you shared here and then state you want 2 template sensors, one for CPU, one for MEM. That’ll get you started with an idea on how to parse the results to pull the data you need into a sensor.
sort of a mal-structured json where ‘result’ isn’t structured itself but containing 2 values in a non-json alike form. If it would have been a propper json stuct it would have been lots easier, but since it’s like that paste the following lines into devtools>template to see what each line does.
{% set d = {
"Utm":[
{
"key":"name",
"name":"Utm",
"result":"CPU: 30.3% | MEM: 11.1%",
"refresh":30,
"timer":28.9655339717865,
"count":3,
"countmin":null,
"countmax":null,
"regex":true
}
]
}
%} {{ d }}
{% set r = d["Utm"][0]["result"] %} {{ r }}
{% set r = r | replace("CPU: ","") | replace("MEM: ","") | replace("%","") %} {{ r }}
{% set one = r.split(" | ")[0] | float %} {{ one }}
{% set two = r.split(" | ")[1] | float %} {{ two }}
you then need to defined 2 template sensors containing the essential lines from above where one needs {{ one }} being the state, the other {{ two }}
but as said … a quick hack. Unsure where you get this json alike information from but I would modify it’s output if possible since then it’ll be lots easier.
Without re-opening the debate, that’s a) because a lot of what it suggests (particularly code snippets) is nonsense that then needs further debugging; b) it encourages users not to learn what’s actually going on, then they come back for more; and c) it’s just laziness, like posting Google search results.