Skip to main content

Scheduler Overview

  1. Navigate to HSYCO Manager

  2. Create a new project or open an existing one

Tip: A scheduler has two graphical modes: compact and wide, depending on the object's width. A width of 750 pixels or more will toggle the wide mode that will display both the list of rules and the rule's details. Because the standard resolution is 640x480, we have to enlarge the size of the landscape.

  1. Change the "Width" to 1024

  1. Change the "Height" to 768

  1. Now go to the Home page

  1. Click "add"

  1. Add a "Scheduler"

  1. Go back to "edit" mode

  1. Enlarge the Scheduler object to fit the horizontal width

  1. Click "add"

  1. Add a "Button"

  1. Click "edit"

  1. You can align the button by clicking "Align" and then "Center Horizontally"

  1. Move the button below the scheduler

  2. Change the "Label" to "Dummy Light 1"

  1. Change the "Action" to "datapoint"

  1. Change the "Datapoint" to "dummy.light.1"

  1. Click "Save" to save the project

Tip: Great! Now we can try the object

  1. Click "Run" and then "Default" to launch the application

  1. The page should look like this:

  1. Click this icon to add a new rule

22. Change the "group" to "dummylight1". This can be any string and represents the group of the rule. If multiple rules have the same group, only the first that has a match will execute

23. Check the "daily mode" check. This makes the rule repeat on a daily basis

  1. Now select a start date and an end date for the rule

25. This rules repeats every day of the week. If you want to have some days where this rule is not executed, just uncheck one or more days

26. Leave "mode" at "on". This means that the rule is always executed. The "interval" mode means that is goes on and off for a fixed interval of time, while the "off" mode means that it will not be executed

  1. Click this icon to confirm

  1. As you can see on the left of the object, the rule has been added

Tip: Now we need to write some code to capture the TIMER event launched when date and time interval are matched and turn on and off the dummy light

  1. Go into the "File Manager"

  1. Navigate into the "events" folder

  1. Click "New File"

  1. Give it a name ("scheduler.txt" for example) and click "New File"

**33. Copy the following code and save the file:

timer dummylight1 = on : io dummy.light.1 = 1
timer dummylight1 = off : io dummy.light.1 = 0

What this does is it turns on and off the "dummy.light.1" when the timer "dummylight1" is on and off. "dummylight1" is the group of the rule that we added in the scheduler object**

  1. Now if we go back to the opened project and we wait until the execution time, we'll see that the light will turn on and, at the end of the time interval, will turn off.

Tip: Now let's suppose that in a specific day we don't want the light to turn on. We can simply achieve that by adding another rule under the same group. As I said in the beginning, If multiple rules belong to the same group, only the first one that has a date/time match will execute

35. Go back to the scheduler object. Click this icon to add a new rule

  1. Change the "group" to "dummylight1" (the same we used for the other rule)

  1. Give it also a description like "block" to know that this rule is blocking all the others in the same group

  1. Enable the "daily mode" and set the same date/time interval as in the other rule

  1. Now uncheck the "every day" checkbox

  1. Select only one day when the execution will be blocked (on Monday for example)

  1. Set the "mode" to "off"

  1. Click this icon to confirm

43. Now, on every Monday in the date interval set, this new rule will be executed before the one previously created because it matches date and time, and all the rules in the same group will not be considered and executed. On the other days of the week, the newly created rule will not match the date/time interval so the second one will be executed because that matches