Logic Machine Forum
Schedule on/off - 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: Schedule on/off (/showthread.php?tid=2061)



Schedule on/off - BMA - 01.05.2019

Hello,

How can i make a button on my visualization that turn a spesific schedule on and off?


RE: Schedule on/off - Rauschentofft - 01.05.2019

Hi.

You can use this script to get your function.

-- Enables / Disables schedulers

name = 'Scheduler 1'

active = event.getvalue()



db:update('schedulers', { active = toboolean(active) }, { name = name })

clearschedulers()



--------------end---------------------

--------------put this in common functions---------------------

function clearschedulers()

  local files = io.ls('/tmp')

  for _, file in ipairs(files) do

    if file:find('lm-scheduler-', 1, true) then

      os.remove('/tmp/' .. file)

    end

  end

end
---------------------end-------------------------------------------


RE: Schedule on/off - BMA - 01.05.2019

Thanks for your reply, I'm new to this scripting so where do i need to change the script to make it fit my Schedule name?


RE: Schedule on/off - Rauschentofft - 02.05.2019

Change Scheduler 1 to your name.


RE: Schedule on/off - BMA - 03.05.2019

(02.05.2019, 05:39)Rauschentofft Wrote: Change Scheduler 1 to your name.

Thanks, it works!  Smile