Logic Machine Forum
Script for division of an value - 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: Script for division of an value (/showthread.php?tid=5176)



Script for division of an value - woxvoll@hotmail.com - 29.12.2023

I'm new in scripting, and I'm looking for a script where i can take group adress and change it from wh to kWh by dividing the value by 1000.
I'm using powertag for measure the energy but the result  from the powertag is in w and wh


RE: Script for division of an value - Erwin van der Zwart - 29.12.2023

I would download the profile and edit it to add a value multiplier in the profile, this way you have a direct output in the desired format.

See: https://kb.logicmachine.net/misc/modbus-profile/

Look for: value_multiplier


RE: Script for division of an value - admin - 02.01.2024

Alternatively you can use an event script:
Code:
value = event.getvalue()
value = value / 1000
grp.checkupdate('0/0/3', value)