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



INIT SCRIPT - Frank68 - 25.03.2021

Hello

I would like to store parameters (email addresses, numbers for sms) in some parameters and give the possibility to the end user to change them.
Can I make the user change the data and store them in a file and have them recovered from the init script when the device is turned on?

Thanks so much


RE: INIT SCRIPT - admin - 25.03.2021

You can use virtual objects with "250 byte string" data type for this.


RE: INIT SCRIPT - Frank68 - 25.03.2021

(25.03.2021, 11:05)admin Wrote: You can use virtual objects with "250 byte string" data type for this.

Yes,
I am using string values but if user changes the value at the next reboot what values will the empty string have or earth the previous value?


RE: INIT SCRIPT - admin - 25.03.2021

Object values are saved in the database which is saved to disk every 30 minutes. The only case when changes might be missing is if the user changes something then does a power cycle right away.


RE: INIT SCRIPT - Frank68 - 25.03.2021

(25.03.2021, 12:05)admin Wrote: Object values are saved in the database which is saved to disk every 30 minutes. The only case when changes might be missing is if the user changes something then does a power cycle right away.

thank you so much


RE: INIT SCRIPT - admin - 25.03.2021

One simple solution is to use a single resident script and poll button state periodically. If the state changes then run the open/close algorithm. Once it's finished then the polling starts again. Just make sure to add a delay between polling (at least 0.5 seconds) so you don't overload the CPU.