Digital Loggers

Customize your power controller using simple, powerful Lua scripting.


Updated 02/19/2024

Advanced Power Control - Lua Scripting

On its own, a power switch isn't very smart.  Add custom functionality using the built-in simple Lua scripting language. It's really simple. No programming experience is required.  Give it a try!

 

Main Lua scripting page

Reboot the modem weekly


To start automatically upon power up, set the start script



After entering the scripts (or copy/paste) and saving it, select the script to run and press the Start button to start it.
Start Scripts
-- Firmware 1.8.x and higher required for event stream. 
-- If lower firmware , use a while loop.
-- Constants for convenience
local Sun, Mon, Tue, Wed, Thu, Fri, Sat =1,2,3,4,5,6,7
local Modem =1     -- Modem outlet

-- Reboot the modem Sundays at 3:00am
function reboot_modem_weekly()
  for i,t,data in event.stream(event.local_time({wday=Sun,hour=3,min=0})) do
    outlet[Modem].off()
    delay(45) 
    outlet[Modem].on()  
  end
end

Have a smart script or unique way to use your switch?  Let us know!

engineering@digital-loggers.com