Hi,
Here is a link to a screen shot using the scheduler from the action tree.
The early scheduler documentation is posted below. As Ron mentioned above, we will have a complete and professional help file/manual for G4. The beta's already include an early example.
Mike
Scheduler Object
Sched = scheduler.Create(string [eventstring], [number [devicenumber]])
A scheduler object has one eventstring and device number associated with it. The scheduler object has a few methods.
res, error = Shed:Start() -- res = TRUE on success, nil on error.
res, error = Shed:Stop() -- res = TRUE on success, nil on error.
Destroy()
res, error = Shed:RemoveTask(number taskid) -- res = TRUE on success, FALSE on Task not found, nil on error.
res, error = Shed:Clear() -- res = TRUE on success, nil on error.
list, error = Shed:ListProperties() -- list = a table on success and nil on error.
Every Scheduler object can have many Tasks. Tasks are the guts of the scheduler, they tell it when to fire this event. All possible tasks are listed below.
taskid, error = Shed:HourTask(number [Every], number [Minute], [number [Repeat]], [timetable [begin]], [timetable [end]])
taskid, error = Shed
ayTask(number [Every], number [Hour], number [Minute], [number [Repeat]], [timetable [begin]], [timetable [end]])
taskid, error = Shed
ayOfWeekTask(number [Every],number [DayOfWeek] number [Hour], number [Minute], [number [Repeat]], [timetable [begin]], [timetable [end]]) (Sunday = 0, Monday = 1, and so on)
taskid, error = Shed
ayOfMonthTask(number [Every],number [DayOfMonth] number [Hour], number [Minute], [number [Repeat]], [timetable [begin]], [timetable [end]])
taskid, error = Shed:SunsetTask(number [Every], number [Latitude], number [Longitude], [number [Repeat]], [timetable [begin]], [timetable [end]])
taskid, error = Shed:SunriseTask(number [Every], number [Latitude], number [Longitude], [number [Repeat]], [timetable [begin]], [timetable [end]])
For all of these [Every] means 'every X intervals' for example, if you choose DayTask, entering 2 for every will mean that this event is fired every other day. Starting today or [begin]. [Repeat] specifies how many times this event should be fired after now or [begin]. The timetable is a table that is defined as follows.
timetable = {
Month
Day
Year
Hour
Minute
}
To setup an event that fires every second sunset, say for your irrigation system use this code.
-- To make sure that after a system restart we do not accidentally keep watering
-- tell the scheduler about the begin date, this will be used to determine the
-- days to water, not needed if you water every day.
begin={}
begin.Day = 1
begin.Month = 1
begin.Year = 2005
begin.Hour = 12
begin.Minute = 0
WaterScheduler = scheduler.Create('StartWatering')
Location = gir.GetLocation()
WaterScheduler:SunsetTask(2, Location.Latitude, Location.Longitude, scheduler.INFINITE, begin)
WaterScheduler:Start()
--uncomment me if you want to check on the tasks.
--list = WaterScheduler:ListProperties()