24 CONTENTS
7.4.2.7 Debugging
• dump - useful debugging function which outputs the argument to the system log, can be used to inspect state
and even study the modern API itself (try dump(_G)!)
• log - contains methods debug, info, notice, etc. which accept a single string argument and log it at
the corresponding severity level.
7.5 Starting scripts
There are a few ways to start scripts:
• On power up. This feature automatically starts a specified script function when power is first applied. The
default is not to start any function, so pressing the "reset to defaults" button will disable this feature.
• By another thread. One thread can create another by using the thread.run function. For example,
thread.run(func1) creates a new thread that starts executing the func1 function. The execution of
the parent thread continues.
• By issuing an HTTP request. Follow a link http://Your_IP/script.cgi?run=func to start exe-
cution from function func. This can be conveniently used by the end users by assigning the programmable
web links on the left side of the page a target of the form script.cgi?run=func.
• Via AutoPing. The AutoPing system can be configured to automatically start execution when IP con-
nectivity is lost. Enter the line number to execute in the Scripting box to the right of the corresponding IP on
the AutoPing page.
• By manually clicking the Run button. Execution will start with the selected function.
7.6 Editing scripts
You don't need to disable scripting before editing scripts. If you make a syntactic error, the script won't be modified.
Instead, you'll receive an explanatory message pointing to the error.
7.7 Stopping a thread
A thread terminates automatically when the end of its outermost function is reached. Click "Stop all running threads"
to stop everything. You can also stop all scripts via HTTP using http://Your_IP/script.cgi?stop.
7.8 Relay debounce warning
Even with the scripting step delays, it is possible to create a script which will rapidly cycle a relay. This rapid cycling
could result in a over current condition, tripped breaker, or stress to the power controller or attached equipment.
Please be reasonable!
DLI DIN4 User’s Guide: 20170809T111540Z