Logic Machine Forum
Scripting - 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: Scripting (/showthread.php?tid=4484)



Scripting - balatis - 10.01.2023

Good morning,

I want to divide 50 Group Addresses in row (e.x. from 1.1.1 to 1.1.49) and write their results in 1.2.1 to 1.2.49.
Is this possible with a script?

Thank you in advance,
Chris Balatis


RE: Scripting - admin - 10.01.2023

Assign a common tag to all source objects (1/1/1..1/1/49) and map an event script to this tag. This script changes the destination group address middle part from 1 to 2, divides the event value by 10 and writes to the destination group address.
Code:
addr = event.dst:gsub('/1/', '/2/')
value = event.getvalue() / 10

grp.checkwrite(addr, value)



RE: Scripting - balatis - 10.01.2023

The application we want is :

We have almost 50 G.A. from a DALI Gateway, which count the time in seconds, and we want to write them in 50 new G.A., which count the time in hours.


RE: Scripting - Daniel - 10.01.2023

Change 10 to 3600