PDA

View Full Version : Duplicate Schedulers?



Manser
February 26th, 2013, 08:50 AM
Use use the scheduler library for my alarm clock.
I set them from NR.
Everything seems to run OK, but after some weeks, where everything runs fine
I see some of the Schedulers are duplicated in the user interface.
I then have to delete this schedulers manually from the user Interface.

I can't reproduce this error by myself! It happens from time to time!

Here you see how I create the schedulers from lua



local wecker_nr = tonumber(pld2)

if WakeAlarm ~= nil then
print ("Mit wecker stimmt was nicht")
WakeAlarm = nil
WakeAlarm = scheduler.Create("wecker" .. wecker_nr, 235, false)
WakeAlarm:SetUUID(UUID_WeckTab[(wecker_nr)])
else
WakeAlarm = scheduler.Create("wecker" .. wecker_nr, 235, false)
WakeAlarm:SetUUID(UUID_WeckTab[(wecker_nr)])
end

if Weckdaten[wecker_nr][2]== "1" then --montag
WakeAlarm:DayOfWeekTask(1,1,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][3]== "1" then --dienstag
WakeAlarm:DayOfWeekTask(1,2,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][4]== "1" then --mittwoch
WakeAlarm:DayOfWeekTask(1,3,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][5]== "1" then --donnerstag
WakeAlarm:DayOfWeekTask(1,4,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][6]== "1" then --Freitag
WakeAlarm:DayOfWeekTask(1,5,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][7]== "1" then --samstag
WakeAlarm:DayOfWeekTask(1,6,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][8]== "1" then --sonntag
WakeAlarm:DayOfWeekTask(1,0,string.sub(Weckdaten[wecker_nr][1],1,2),string.sub(Weckdaten[wecker_nr][1],3,4))
end
if Weckdaten[wecker_nr][9]== "1" then
WakeAlarm:Start()
else
WakeAlarm:Stop()
end

--Abspeicherung / löschen des Temp.LuaScheduler / Neu Laden für Betreib
scheduler.SaveToXML(WakeAlarm)

WakeAlarm:Clear()
WakeAlarm:Destroy()
WakeAlarm = nil

scheduler.LoadFromXML(global_config .."\\Schedulers\\" .. UUID_WeckTab[(wecker_nr)] .. ".gsh")