Rounded display

Good morning

this function works perfectly but the return format does not suit me.

image

If the temperature is in decimal then it displays the decimal, example: Temp = 23.5° → 23.5°

If the temperature is an integer it displays the integer, ex: 23° → 23°

I would like it to always display in decimal: 23° → 23.0°

I tried with the ROUND function but it doesn’t work.

If someone has an idea…

I’m guessing it’s a string, since it contains °, and you can’t call round on string. If you can create a homeyScript then what you need to do is parseFloat and then call ToFixed(1) on the result

It depens on the LocalAPI app I think. You insert a nuneric token and the app returns a JSON.
How is the JSON built? With numeric value or string value?
If the JSON contains a string element, then it’s converted from number ti string inside LocalAPI app.
I suggest to ask the app developer :wink:

It is a numeric value

image

Have you already checked the data source, means the device capability at Homey Developer Tools ?

that’s to say ?

image

You can use the Better Logic Library app for this.

I meant the capability like…

I also tried to use the logic card to round a value.
Round a value like 1.23 gives 1 as result. So you can round like round(1.23×10)/10 to get 1.2
Problem: round(1x10)/10 gives 1 as result, not 1.0
I would say that’s why you get no zeros as decimal.

Where do you want to see the rounded value?