Ds18b20 only one or two digits

Hello, is it possible to get my temperature values with only one or two fractional digits? For example with a funktion node?

Do you know JavaScript? That's what the function node uses and it is certainly possible in JS to do this, there are lots of examples on the Internet.

I think you could also do it with a change node and JSONata ($round(123.456, 2) => 123.46). You could probably even do it with a change node and a regex :nerd_face:

3 Likes

Usually it is best to do that at the point where you display it. Don't throw away resolution before you need to. For example in a node-red dashboard you can put something like this in the value format field to display it with two decimal places
{{msg.payload | number:2}}

Thank you!

I think that should be {{value | number: 2}}

2 Likes