Decimal Point Placement issue

So, I understand how to set a sensor(entity) output, as to how many zero(s) are after the decimal point. And this is working fine, when displaying a temperature reading in the Frontend. I have my Outside sensor, set for “0.0” and it displays “72.6”

The issue I’m having, is when I ask Alexia for the same Outside Temperature, it will say the Temp, out to 3 places after the decimal point.
I also have a Ulanzi Display running Awtrix 3, and it’s doing the same thing, displaying the Temp as “72.573”

Am I missing something, in my coding???

The UI config for the number of decimal places only affects the frontend. Nothing else.

You can create a template sensor and use a template like this:

{{ states('sensor.my_sensor' ) | round(1) }}

@mekaneck Thanks for the template, I’m familiar with using a template like this one, in an automation. But, not sure how o use it in a Node-Red flow.

Sorry I can’t help with node-red. But that template can be used in a template sensor (Integrations → Helpers → Template). Paste everything including the curly braces into the area for the template. This will create a new sensor that only has 1 decimal place.

Use a change node or any node that can use JSONata.

$round(payload, 1)

image

Thanks, but that didn’t work, I suspect it is because the “Current State” node, just before the “Change” node I inserted. Is outputting a string, and not a number.

I was going to include the Awtrix Flow, that I’m using. But their website(https://flows.blueforcer.de/), is down.

$round($number(payload), 1)

That did the trick, well almost. For the “payload” to get thru the “Parser” node, it needs to be in text format. So my ?, is this a valid statement, in the Change node?

$toString($round($number(payload), 1))

https://try.jsonata.org/TnI59AnBJ

@Kermit Thanks, syntax is everything!!! My mistake, after I tried the code above(-1), I just deleted the “to” from $toString(xxxxx), leaving the “S”.

Oh, and thanks, I did not know about that testing site.
https://try.jsonata.org