Change Active Status of a Script - 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: Change Active Status of a Script (/showthread.php?tid=3369) |
Change Active Status of a Script - jamesng - 13.05.2021 Hi Is it possible to use a script to change the active state of another script? I tried the following code, however it doesn't seem to change the active state / icon in the script list view. (I'm running a Schneider SHAC with the older logic machine firmware which might be the problem) Code: -- Change active status of script I successfully run the following the following code which directly interacts with the database to change the status of schedules - is something similar required to activate / deactivate scripts? Code: -- Change active status of schedule Many thanks in advance Kind Regards James RE: Change Active Status of a Script - admin - 13.05.2021 Does the correct status show up after the page reload? Periodical script status reload (every 6 seconds) has been implemented for some time already. RE: Change Active Status of a Script - jamesng - 13.05.2021 Unfortunately no, the refresh doesn't seem to make a difference (even after 30 secs). I'm referring to the scripts by name (ie: 'Tesla Powerwall - Auto Set Reserved Percentage') - is this ok or should I be using an ID or something different? is there an alternative way to change the status with the old firmware by directly updating the database. Or is there a way I can test if the script.disable() is supported on my firmware? Kind Regards James RE: Change Active Status of a Script - admin - 13.05.2021 Changing the DB value won't help because the script itself will not be stopped or started. See what the enable/disable call returns. If script is found then enable returns true, disable returns false. Otherwise you will get nil + error message. Code: res, err = script.enable('SCRIPT NAME HERE') RE: Change Active Status of a Script - jamesng - 13.05.2021 Hi Here is the output of the your test code - it's working Code: TEST 13.05.2021 18:43:24 I found the error in my earlier code too .. working function below Code: -- Change active status of script Many thanks Kind Regards James RE: Change Active Status of a Script - Dré - 12.10.2021 (13.05.2021, 08:46)jamesng Wrote: Hi Im just a beginner, but i hope you will help me. I will activate and disable a 'Resident script' depending on a feedback object of a output. the group object is 1/4/53 (bedroom [fb]) when this object is true i will run a script to activate the 'Resident script' called 'bedroom [fb], turn off' and the same but turn it off by the same group adress when this object is false i will run a script to disable the 'Resident script' called 'bedroom [fb], turn off' I saw you will do the same, but i dont know how to use this script. RE: Change Active Status of a Script - admin - 12.10.2021 Simply create an event script attached to a 1-bit boolean object and put this into the editor. Code: enable = event.getvalue() RE: Change Active Status of a Script - Dré - 12.10.2021 (12.10.2021, 12:22)admin Wrote: Simply create an event script attached to a 1-bit boolean object and put this into the editor. WoW thanks, so fast i wish i was good as you are just another question, just curious, what is the different between the 2 scripts. or what does do the other script of Topic Starter? RE: Change Active Status of a Script - KoBra - 21.01.2022 I tried to enable and disable a resident PID script with a event script on a virtual object but i can't get it to work. Code: enable = event.getvalue('32/1/59') RE: Change Active Status of a Script - admin - 22.01.2022 Your resident script probably is not called "PID, turn off". Also the group address is not needed for event.getvalue(). RE: Change Active Status of a Script - KoBra - 22.01.2022 (21.01.2022, 22:46)KoBra Wrote: I tried to enable and disable a resident PID script with a event script on a virtual object but i can't get it to work. Thanks, that was the only combination i didn't test. |