Common script does not work in the way I want - 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: Common script does not work in the way I want (/showthread.php?tid=4307) |
Common script does not work in the way I want - Hadeel - 20.10.2022 I have a function called "commpnPost()" in a common script as below. I call this function everytime when there's a change in each KNX status object, so that I can let other servers know that there's a status change in the KNX project. I call it in each event script as the image below. ('9/2/1' is the group address of the status object) However, when I log the output inside the common script, I can see the first argument '9/2/1' somehow changed to '10/4/5'. I also made sure that it already changed to '10/4/5' at the first line of the commonPost function. This happens with other group addresses too. Am I using common script in a wrong way ? Or maybe there is a chace that I need to clear inside LM ? Code: function commonPost(add, value) Code: function convertToDptString(address) RE: Common script does not work in the way I want - admin - 21.10.2022 Check if you have duplicate function somewhere else. You don't have to specify the address manually, use event.dst instead. This way you can map a single event script to a tag instead of creating many event scripts with the same functionality. Don't create JSON strings manually, use JSON library: Code: local payload = require('json').encode({ RE: Common script does not work in the way I want - Hadeel - 25.10.2022 Dear Admin, Thank you for your reply and for your code ! I checked if there was a duplicate function but no....and we tried a factory reset after taking a backup. After the factory reset I uploaded a backup file and everything is working fine now! Probably because the object structure has changed a lot after installing the LM projecet and we uploaded ets project files for few times without deleting the object....maybe the object was linked to the old script ? I started to use event.dst also (: Thank you for your help always (: |