Logic Machine Forum
Round of decimal values without triggering event? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Round of decimal values without triggering event? (/showthread.php?tid=3927)



Round of decimal values without triggering event? - temp4 - 11.03.2022

I have several motion detectors that also reports brightness in lux every 5 minutes or so. The associated group objects seem to require (?) 2-byte unsigned floats to function. But for visualization in Wiser for KNX Touch3 I would like to drop the decimals and show integers instead.

Now values look like: 25573.72 (lux)
I am happy with: 25574 (lux) for a less cluttered look

What is the best way to do this?

Changing the values with an event-based Lua-script will cause a loop (the script calls itself repeatedly) that can only be canceled by rebooting the Wiser for KNX unit.

All the best
Robert


RE: Round of decimal values without triggering event? - mkaymak - 11.03.2022

I recommend a resident script to round your Lux values.Resident script will not cause a loop.


RE: Round of decimal values without triggering event? - Erwin van der Zwart - 11.03.2022

You don’t need any script, just set the decimals to zero in the vis params of the object..


RE: Round of decimal values without triggering event? - admin - 11.03.2022

Vis. params do not affect object display in Mosaic/Touch3. The easiest solution is to create a virtual object with 2-byte unsigned data type and map an event script to the sensor object that has a floating point value.
Code:
value = event.getvalue()
grp.checkupdate('32/1/1', value)