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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login