round to one decimal in UI flow
-
Hi there,
Is there a way to round a variable to 1 decimal like in Python round(3.14,1) achieves 3.1
In the Math folder of UI flow, there is a round operator but there are only 3 possibilities : round, roundup and round down.
I am using the environement sensor and my temperature shows up with plenty of non signidicant decimals 28.1234 deg C. I would like to indicate 28.1..
Did I miss something ? -
@csierra67 could you multiply by 10, then round, then divide by 10?
-
Thanks a lot ! Did not come to me as it is implemented directly in u pythonj but I remember having read about this workaround when I used to program in other languages.
Took me a little bit of time to set this up in UI Flow but it works perfectly of course. -
Under Text you will find this option, at the very bottom: Reduce ... to x decimal places. It has been tucked away a bit, but works very well.
-
@riddsprojects Thanks. Glad to have learned something, works well indeed