This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Create/Delete scheduler with a script
#1
Hello,

Is it possible to create/delete a scheduler with defined parameters (name, controlled object, events with their starting times/values...) with a script? if so, how?

Thanks in advance.
Reply
#2
For now the only solution is to use DB queries. You can find some info here:
https://forum.logicmachine.net/showthread.php?tid=265

You will also need to call clearschedulers() after making any changes, see post #12 there for function code.
Reply
#3
Thanks for Your answer. Yes, I'm already aware of the possibility of modifiying schedulers with DB queries. In future would be very nice to see ability to create/delete schedulers from a script.
Reply
#4
Hi

I'm working on a "high availability" solution. Where I do have two spaceLynks (primary and secondary). When primary fails, secondary is activating his own scripts (script.categoryenable('HA_Category')) and is going to overtake the work. It works so far. The only problem is, that I cannot enable/disable schedulers by scripting.

My only Solution so far: Manualy deactivate/activate the schedulers on the UI => It's not a big deal because, it has only to be done when primary fails, which hopefully never happens.

But it would be great if I could do that also by scripting, without dealing with the db. IMHO this is "dangerous" because of possible incompatiblies with future FW-Releases.

I would realy appreciate a enable/disable function for schedulers, just like there is one for scripts Smile

best regards
Reply
#5
Hi,

FW 2.4.0 is just released and should be already or comming soon on our website.

in this version we added enabling schedulers by object.

BR,

Erwin
Reply
#6
This sounds very interesting! I just installed FW 2.4.0 Smile

Do you have a quick example to do enabling/disabling in lua-script?
Reply
#7
Hi
I do the same thing. I've primary and backup LM.
My code for enabling/disabling schedulers is here:
Code:
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

function ecl_enable_all_schedulers(ai)
  -- ai must be 0 - inactivate 1 - activate
db:update('schedulers', {
    active = ai
})

_clearschedulers()
end
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#8
In the Schedule Events db entry what is the function of "offset_hour" "offset_min", do these advance and delay the timer? If so does it handle day rollover (if say off time is advanced beyond midnight)?
Reply
#9
This only affects sunrise and sunset modes. Rollover cases are handled.
Reply


Forum Jump: