Skip to main content

EVENTS programming quickstart

  1. Navigate to HSYCO Manager

To access HSYCO Manager open a browser and type the URL:

https://192.168.1.50/hsycoserver/manager

note

The IP address and the URLKey written above are the default ones

  1. Open the "Project Editor"

  1. Create a "New Project"

  1. Give it a name ("myproject1" for example) and click "Create"

Landscape Project

  1. Change the "Width" to "800"

  1. Change the "Height" to "600"

  1. Open the "home" page

Text Object

  1. Click "add"

  1. Add a simple "Text"

  1. Go back to "edit" mode

  1. Change the "ID" to "mytext1"

  1. Change the "Text" attribute to "My Text 1"

  1. Click "Save" to save the project

  1. Click here.

EVENTS code to change font color

  1. Open the "Code Editor"

  1. Click "New Events File" to create a blank EVENTS file

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

  1. Copy the following code and save the file:

    INIT : UISET mytext1.fontcolor = "red"

    This sets the "fontcolor" attribute of the object with id "mytext1" to "red"

  1. As you can see, the font color is now red

Dummy Server

  1. Open the "Settings"

  1. Select "I/O Servers"

  1. Click "+" to add a new server

  1. Select the "DUMMY" type and give the server an "ID" ("dummyserver2" for example). Click "Confirm"

  1. Edit "Options" to add attributes to the server

  1. Select the "dimmers" option and give it a value of 1. Click "OK" to confirm

  2. Click "+" again

  3. Select the "lights" option, give it a value of 3 and click "OK"

  4. Click "Save"

  5. Click "Save" again and wait for HSYCO to restart

Dimmer Button

  1. Go back to "Project Editor"

  1. Click "add"

  1. Add a "Button"

  1. Change the "ID" to "mydimmer1"

  1. Change the "Label" to "Dummy Dimmer 1"

  1. Change the "Action" to "datapoint"

  1. Change the "Datapoint" to "dummyserver2.dimmer.1"

  1. Click "Save"

  1. Normally, pressing a dimmer button will open this popup to select the percentage of the dimmer

Keypad

  1. Click "add"

  1. Add a "Keypad"

  1. Change the "ID" to "mykeypad1"

  1. Change the "Name" to "$mykeypad1"

  1. Change the "Min" attribute to "0"

  1. Change the "Max" attribute to "100". Dimmers lights have values that go from 0 to 100 so setting the minimum and maximum value prevents us from inputting values outside of that range

  1. Click "Save"

EVENTS code to control dimmer with keypad

  1. Open the "Code Editor"

  1. Click "New Events File". You can create as many events file as you want, as long as they have different names (you can't have two files with the same name and different case) and they all have .txt extension

  1. Give the file a name ("myevents2.txt" for example) and click "New File"

  1. Copy the following code and save the file:

    $MYKEYPAD1 : IO dummyserver2.dimmer.1 = $MYKEYPAD1, UISET mykeypad1.value = ""

    What this does is it sets the dummy dimmer value to the value in the "$mykeypad1" variable and then it empties the keypad so that new values can be selected

  1. Insert a value and click "Ok"

  1. As you can see, the dimmer light has now a percentage of 50%

Lights buttons

  1. Go back to "Project Editor"

  1. Click "add"

  1. Add a "Button"

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

  1. Change the "Action" to "datapoint"

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

  1. Right-click the button and select "Duplicate"

  1. Change the "Label" of the second button to "Dummy Light 2"

  1. Change the "Action" to "datapoint" and the "Datapoint" attribute to "dummyserver2.light.2"

  1. Click "Duplicate" again

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

  1. Change the "Action" to "datapoint" and the "Datapoint" attribute to"dummyserver2.light.3"

User button

  1. Click "add"

  1. Add another "Button"

  1. Change the "Label" to "Lights OFF"

  1. Change the "Action" to "command"

  1. Change the "Name" to "lights". This is the name of the command passed to the server

  1. Change the "Parameter" to "off"

  1. Click "Save"

EVENTS code to control lights with user button

  1. Open again the "Code Editor"

  1. Click "Open Events"

  1. Click "myevents2.txt" to reopen the previous file

  1. Add the following lines to the file:

    USER lights = "OFF" : IO dummyserver2.light.1 = 0, IO dummyserver2.light.2 = 0, IO dummyserver2.light.3 = 0
    IO dummyserver2.dimmer.1 = "100%" : IO dummyserver2.light.1 = 0, IO dummyserver2.light.2 = 0, IO dummyserver2.light.3 = 0

    What this does is it sets all three lights to status "0" when the USER command called "lights" is "off". Also, when the dimmer light is at 100%, the three lights will be turned off