leardinet
(Leardinet)
1
Temperatura Caldaia (Server Blynk)
gives me this result [“70.688”]
I have to convert it to
70.7
If you have jq
available locally, you could try adding | jq -r '.[0]'
to the command line.
123
(Taras)
3
Try this:
value_template: "{{ value[0] }}"
123
(Taras)
5
When you said this:
I assumed it received a list (because that’s how a list would appear) and so value[0]
would return the first item in the list (which would be 70.688).
However, you reported that it didn’t work which means it’s not a list but a string (and it simply has the appearance of a list).
In that case, the simplest way to extract the value is to slice off the parts you don’t want which are the first two and last two characters.
value_template: "{{ value[2:-2] | round(1) }}"
The technique used is python’s native string-slicing capability.
Here’s a screenshot of the Template Editor demonstrating that the technique works:
1 Like