Difference between revisions of "Action Keywords"

From HSYCO
Jump to navigation Jump to search
 
(47 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
[[Category:Events]]
 
An action is defined as a keyword that identifies the action type, always followed by one or more parameters and sometimes the equal (assignment) operator.
 
An action is defined as a keyword that identifies the action type, always followed by one or more parameters and sometimes the equal (assignment) operator.
  
Line 5: Line 6:
 
== System Keywords ==
 
== System Keywords ==
 
=== DATESET ===
 
=== DATESET ===
 +
 +
Set the HSYCO Server’s system clock.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| DATESET = datetime
 +
| set the HSYCO Server operating system’s clock and hardware clock
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* datetime - date and time formatted as "YYYY-MM-DD hh:mm:ss" or "YYYYMMDDhhmmss", in the local time zone
 +
 +
 +
'''Examples:'''
 +
 +
DATESET "2014-10-31 20:00:00"
 +
DATESET "20141031200000"
 +
 
=== HAACTIVE ===
 
=== HAACTIVE ===
 +
 +
Force a master HSYCO server to become inactive, or return to the active state.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| HAACTIVE = false
 +
| force a master to become inactive (has no effect on the slave system)
 +
|-
 +
| HAACTIVE = true
 +
| used after the master was forced to become inactive, returns it to the active state (has no effect on the slave system)
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* active - true or false
 +
 +
 +
'''Examples:'''
 +
 +
IO mygate.connection = offline : HAACTIVE = false
 +
 
=== POWER ===
 
=== POWER ===
 +
 +
Sets the electric power state variable.
 +
 +
The power value is shown in the navigation or status bar of the Web interface.
 +
 +
Besides setting the power value, this method also triggers the execution of the powerEvent() callback and the POWER event in EVENTS.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| POWER = power
 +
| sets the electric power state variable to a specific value, in Watts
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* power - the power in Watt units.
 +
 +
 +
'''Examples:'''
 +
POWER = IO meter.power
 +
 
=== PROGRAMTIMER ===
 
=== PROGRAMTIMER ===
 +
 +
Creates or deletes a program timer.
 +
 +
{| class="wikitable"
 +
| width=280 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| PROGRAMTIMER name = SET seconds
 +
|
 +
a program timer will be executed after the number of seconds specified in SET.<br>
 +
If a program timer with the same name has already been set, the action will be ignored
 +
|-
 +
| PROGRAMTIMER name = CLEAR
 +
| deletes a timer
 +
|-
 +
| PROGRAMTIMER name = RESET seconds
 +
| similar to SET, but if a program timer with the same name has already been set, the timer settings will be changed to the new timeout
 +
|-
 +
| PROGRAMTIMER name = REPEAT seconds
 +
| sets a program timer that is executed repeatedly with an interval  equal to the specified number of seconds
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the program timer name
 +
* seconds - the timeout, in seconds.
 +
 +
 +
'''Examples:'''
 +
 +
SECURITY evo = ON 1  : PROGRAMTIMER presence = REPEAT 3600
 +
SECURITY evo = OFF 1 : PROGRAMTIMER presence = CLEAR
 +
 
=== WAIT ===
 
=== WAIT ===
 +
 +
Pauses before the execution of the next action.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| WAIT = s
 +
|
 +
causes a pause in the execution of actions for the specified number of seconds.<br>
 +
It can be also set in decimal format
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* s - wait time in seconds
 +
 +
 +
'''Examples:'''
 +
 +
WAIT = 5
 +
WAIT = 0.3
  
 
== Cameras ==
 
== Cameras ==
 
=== CAMERA ===
 
=== CAMERA ===
 +
 +
The CAMERA action is used to temporarily disable cameras’ live view and recording features.
 +
 +
{| class="wikitable"
 +
| width=180 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| CAMERA name = ON
 +
| live view enabled
 +
|-
 +
| CAMERA name = OFF
 +
| live view and recording disabled
 +
|-
 +
| CAMERA name = RECON
 +
| recording enabled
 +
|-
 +
| CAMERA name = RECOFF
 +
| recording disabled
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the camera’s id. You can specify a list of space separated ids.
 +
 +
 +
'''Examples:'''
 +
 +
* CAMERA entrance = ON
 +
 
=== CAMERAREC ===
 
=== CAMERAREC ===
 +
 +
Records video from a camera.
 +
 +
{| class="wikitable"
 +
| width=180 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| CAMERAREC name = sec
 +
| records for the number of seconds defined with the set attribute
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the camera’s id. You can specify a list of space separated ids
 +
* sec - recording time in seconds. If set to 0, stops the current recording.
 +
 +
 +
'''Examples:'''
 +
 +
CAMERAREC openspace = 30
 +
 
=== CAMERARECFULL ===
 
=== CAMERARECFULL ===
 +
 +
Records video from a camera, like CAMERAREC, but ignores the DroppedFrames parameter in hsyco.ini, so that all frames captured from the camera during the recording period are recorded with no skips.
 +
 +
{| class="wikitable"
 +
| width=200 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| CAMERARECFULL name = sec
 +
| records for the number of seconds defined with the set attribute
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the camera’s id. You can specify a list of space separated ids
 +
* sec - recording time in seconds. If set to 0, stops the current recording.
 +
 +
 +
'''Examples:'''
 +
 +
CAMERARECFULL openspace = 30
  
 
== Data Logger ==
 
== Data Logger ==
 +
 +
Data loggers collect and display statistical data on the variation of a specified value.
 +
 +
They can be used to automatically generate trend charts and log the data as CSV files.
 +
 +
See the [[System_Architecture#Data_Logger|Data Logger]] documentation for additional information.
 +
 
=== DATALOGGER ===
 
=== DATALOGGER ===
 +
 +
Updates and performs operations on a data logger.
 +
 +
{| class="wikitable"
 +
| width=360 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| DATALOGGER name = value
 +
|
 +
Supplies the data logger with a new value to be processed.<br>
 +
It will also trigger the refresh procedure
 +
|-
 +
| DATALOGGER name = CLEAR
 +
| Clears the data gathered in the data logger
 +
|-
 +
| DATALOGGER name = ERROR
 +
| Used with counter data loggers, resets the internal delta baseline
 +
|-
 +
| DATALOGGER name = FILE LOG filename [TIMESTAMP]
 +
|
 +
Appends the last acquired value to the specified file (filename) using the CSV format.<br>
 +
If the option TIMESTAMP is specified, the timestamp of the record will be reported too
 +
|-
 +
| DATALOGGER name = FILE STAT filename
 +
| Creates or updates the specified file (filename) with the currently gathered data using the CSV format
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - identifier of the data logger. It is possible to use a list of names separated by spaces to address several data loggers. Variables can be used
 +
* filename - the file pathname. You can use multiple distinct strings, including variables, that will be concatenated to create the file name.
 +
 +
 +
'''Examples:'''
 +
 +
$value : DATALOGGER energy = $value,
 +
  DATALOGGER energy = FILE LOG userdata/energylog.csv TIMESTAMP,
 +
  DATALOGGER energy = FILE STAT userdata/energystat.csv
 +
 +
TIME : DATALOGGER temperature = IO ste.1
 +
TIME : DATALOGGER humidity = IO ste.2
  
 
== DMX ==
 
== DMX ==
Line 24: Line 274:
  
 
{| class="wikitable"
 
{| class="wikitable"
| width=160 | '''Action'''
+
| width=200 | '''Action'''
 
| '''Description'''
 
| '''Description'''
 
|-
 
|-
Line 67: Line 317:
 
== Infrared Control ==
 
== Infrared Control ==
 
=== IR ===
 
=== IR ===
 +
 +
Sends a command to an IRTrans.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| IR name = command
 +
| the IR code must be in the local IRTrans FLASH memory database or, If the hsyco/ir directory contains a .ccfhex file corresponding to the database name, then the CCF string in that file is used instead of sending the command stored in the IRTrans internal database
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - identifies the IRTrans, as defined with the IRTrans parameter in hsyco.ini
 +
* command - the command format is remote.command; that is the remote control database name followed by a dot and the command name.
 +
 +
 +
'''Examples:'''
 +
 +
IR theater = dvd.play
  
 
== I/O Servers ==
 
== I/O Servers ==
Line 103: Line 374:
  
 
== Leak Detector ==
 
== Leak Detector ==
 +
 +
{{leak_detector_description}}
 +
 +
 
=== LEAK ===
 
=== LEAK ===
 +
 +
Controls the integrated leak detector.
 +
 +
The detector’s logic uses two parameters to set its sensitivity and time base.
 +
 +
The detector generates a warning if the flow deviation constantly remains below the deviation threshold for the time period.
 +
 +
You can change the defaults to adapt to your specific conditions.
 +
 +
{| class="wikitable"
 +
| width=180 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| LEAK name = value
 +
|
 +
calls the leak detector passing the current liters counter value.<br>
 +
Using variables or references to IO data points is supported
 +
|-
 +
| LEAK name = PERIOD t
 +
|
 +
changes the time base. The default is 1200 seconds.<br>
 +
Set the period to 0 to temporarily disable the detector.<br>
 +
The time base can be changed anytime, even when the detector is already processing data
 +
|-
 +
| LEAK name = DEVIATION d
 +
|
 +
changes the deviation percentage. d should be a number between 1 and 100. The default is 50.<br>
 +
Set the deviation to 0 to temporarily disable the detector.<br>
 +
Lower values cause the algorithm to activate leak warnings only when the flow is very constant in time, becoming less susceptible to false alarms, but a value that is too low could miss actual leaks. Higher values could easily generate false alarms. <br>
 +
The deviation can be changed anytime
 +
|-
 +
| LEAK name = CLEAR
 +
|
 +
clears the detector’s internal state.<br>
 +
In normal applications, there is no need to call this function, as the detector automatically clears its state from old data
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the name of a leak detector. Using different names you can implement several independent leak detectors
 +
* t - time base
 +
* d - deviation percentage
 +
 +
 +
'''Examples:'''
 +
 +
HSYCOSTART : PROGRAMTIMER modbusread = repeat 4
 +
PROGRAMTIMER modbusread :  IO modbus.2.768 = readholdingregisters:uint, LEAK water = IO modbus.2.768
 +
LEAK water = ON : MAIL "john@example.com" = "hsyco@example.com" "Urgent Message from HSYCO" "Leak Detected"
 +
LEAK water = OFF : MAIL "john@example.com" = "hsyco@example.com" "Message from HSYCO" "Leak Reset"
  
 
== Log ==
 
== Log ==
 
=== FILELOG ===
 
=== FILELOG ===
 +
 +
Appends a generic text message at the end of a file.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| FILELOG filename = text
 +
| you can use multiple unquoted words, quoted strings and variables, that will be appended at the last line of the text file
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* filename - the file name. You can specify any path, starting from HSYCO’s base directory. If the file or parent directories don’t exist, they will be created automatically. The filename parameter can be a variable
 +
* text - the message that will be appended at the last line of the text file.
 +
 +
 +
'''Examples:'''
 +
 +
HSYCOSTART : FILELOG logs/mylog.txt = "log message example"
 +
 
=== LOG ===
 
=== LOG ===
 +
 +
Generates an information message in the daily log file.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| LOG = text
 +
| you can use multiple unquoted words, quoted strings and variables, that will be appended to the log message
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* text - the log message
 +
* from - the sender e-mail address.
 +
 +
 +
'''Examples:'''
 +
 +
LOG = "log message example"
 +
LOG = "Time: " $TIME:H-M-S$ " DATE: " $DATE:D/M/Y$
  
 
== Mail ==
 
== Mail ==
 
=== MAIL ===
 
=== MAIL ===
 +
 +
Sends an email message.
 +
 +
{{mail_send}}
 +
 +
 +
{| class="wikitable"
 +
| width=200 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| MAIL to = from subject body
 +
|
 +
sends text and camera images.<br>
 +
The body part of the mail is the last attribute. You can email the same message to multiple recipients
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* to - the recipient address. It is possible to send the same email to a space  separated list of email addresses. You can optionally specify the destination SMTP server name or IP address by appending :server name or address to the recipient's email address, for example: john@example.com:192.168.1.1
 +
* from - the sender e-mail address
 +
* subject - a quoted string or variable with the message object
 +
* body - the message body. To send an ordinary text, just enter a quoted text string. To send an image, append strings with the following format: “cam:cameraname[:seconds_back]”. For example, “cam:door” sends a live frame from the camera called “door”; “cam:door:2” sends a frame that was recorded two seconds before the last recorded frame; “cam:door:0” sends the last recorded frame. To send files as attachments, use the following format: “file:file name”. The file path is relative to the HSYCO root directory.
 +
 +
 +
'''Examples:'''
 +
 +
In this example, we send a message every minute, with the measured power load, to two email addresses:
 +
 +
TIME : $BODY = "Energy consumption for " $DATE:y/m/d$ " at " $TIME:h:m:s$ " is " $power$ " Watt"
 +
$BODY : MAIL email1@hsyco.com email2@hsyco.com = hsyco@hsyco.net “Sent from HSYCO” $BODY
 +
 +
40 seconds after the alarm event, an email from the address hsyco@hsyco.net is sent to emal1@hsyco.com,  with three images attached: the first is a real time image, the second is the last recorded image, the third one is the frame that was recorded 15 seconds before:
 +
 +
user "security" = "alarm" : CAMERAREC entrance = 30, PROGRAMTIMER rec = 40
 +
PROGRAMTIMER rec : MAIL email1@hsyco.com = hsyco@hsyco.net “Sent from HSYCO” “Camera entrance” “cam:entrance” “cam:entrance:0” “cam:entrance:15”
 +
 +
At midnight, we are sending the energy.csv file in the data sub-directory as an attachment:
 +
 +
TIME = 0000: MAIL email1@hsyco.com = hsyco@hsyco.net "Sent
 +
from HSYCO” "Energy daily report." file:data/energy.csv
  
 
== Network Services ==
 
== Network Services ==
 
=== PING ===
 
=== PING ===
 +
 +
Tests the reachability of one or more hosts, identified by their hostnames or IP addresses, within the optional timeout defined in milliseconds (or using a default timeout of 200 ms).
 +
 +
This test generates PING events like PING hostname = ON if the host is reachable, or PING hostname = OFF if not reachable.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| PING hostname
 +
| test the reachability of hostname, with 200ms response time-out
 +
|-
 +
| PING hostname = time
 +
| test the reachability of hostname, with a specific response time-out
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* hostname - the IP device name or IP address
 +
* time - response time-out, in milliseconds.
 +
 +
 +
'''Examples:'''
 +
 +
TIME : PING 192.168.1.1
 +
TIME : PING 192.168.1.200 192.168.1.201 = 1000
 +
 
=== URL ===
 
=== URL ===
 +
 +
Sends a GET or POST HTTP or HTTPS request to the specified url.
 +
 +
The HTTP basic or digest access authentication methods are supported.
 +
 +
Responses can be checked using the corresponding URL event.
 +
 +
{| class="wikitable"
 +
| width=320 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| URL GET "url"
 +
| sends a GET request without authentication
 +
|-
 +
| URL GET "user:password" "url"
 +
| sends a GET request with authentication
 +
|-
 +
| URL POST "url" "content_type" "data"
 +
| sends a POST request without authentication
 +
|-
 +
| URL POST "user:password" "url" "content_type" "data"
 +
| sends a POST request with authentication
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* url - a full url, including the mandatory http:// or https:// query scheme and optional query string
 +
* user:password - user and password for basic or digest access authentication
 +
* content_type - the MIME type descriptor for the POST data
 +
* data - the URL-encoded POST data sent with the request.
 +
 +
 +
'''Examples:'''
 +
 +
<nowiki>HSYCOSTART: URL POST "http://10.0.0.5/cgi-bin/cmd.sh" "text/xml" "%3C%3Fxml%20version%3D%22..." </nowiki>
 +
 +
<nowiki>TIME 0800: URL GET "usr1:qi3qw" "http://10.0.0.5/cgi-bin/cmd.sh?id=relay1"</nowiki>
 +
 +
<nowiki>URL "http://10.0.0.5/cgi-bin/cmd.sh?id=relay1" : LOG = "relay opened"</nowiki>
  
 
== Public Announcement ==
 
== Public Announcement ==
 
=== AUDIO ===
 
=== AUDIO ===
 +
 +
The AUDIO action is used to play text-to-speech messages or recorded audio files.
 +
 +
Audio can be sent to the Web browser, the server’s audio line out connector, the internal speaker or audio out line of Axis cameras, SNOM's phones or PA devices, and I/O servers with audio playback capabilities.
 +
 +
See the [[Audio and Public Announcement]] section for additional information.
 +
 +
{| class="wikitable"
 +
| width=240 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| AUDIO to = FILE filename
 +
| plays a pre-recorded audio file
 +
|-
 +
| AUDIO to = VOICE:voicename message
 +
| converts a text message to speech and plays the audio
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* to - the audio destination (see table below)
 +
* filename - the pathname of the audio file, relative to the HSYCO’s main directory
 +
* voicename - the voice name for the text-to-speech engine; see the [[Audio and Public Announcement]] section for additional information
 +
* message - the text message for text-to-speech conversion; you can use multiple strings that will be automatically appended.
 +
 +
 +
{| class="wikitable"  width="600"
 +
! Audio Destination
 +
! Description
 +
|-
 +
| width="150" | speaker
 +
| the server’s audio line out connector
 +
|-
 +
| web
 +
| the Web browser’s audio output<br>{{tip|this feature is supported only on Firefox and Chrome browsers}}
 +
|-
 +
| axis@camera id
 +
| audio sent to an Axis camera, using the camera id defined in the Cameras parameter in hsyco.ini
 +
|-
 +
| axis@host name
 +
| audio sent to an Axis geric audio device. Use the host name or IP address of the device. The device must allow anonymous commands via HTTP on the default port 80
 +
|-
 +
| snom@ip:port
 +
| audio sent to SNOM phones and public announcement devices, to the multicast IP address and port specified (the IP address and port should be configured as multicast addresses on each phone)
 +
|-
 +
| io@I/O server id[.zone id]
 +
| audio sent to I/O servers with audio playback capabilities, e.g. the Sonos I/O server
 +
|}
 +
 +
 +
'''Examples:'''
 +
 +
The gong.mp3 audio file is played every minute through the server’s audio line out or internal speaker:
 +
 +
TIME : audio speaker = file "audio/gong.mp3"
 +
 +
Same as above, but played at the same time on all phones registered to the 239.255.255.245 multicast address and port 5555:
 +
 +
TIME : audio snom@239.255.255.245:5555 = file "audio/gong.mp3"
 +
 +
Same as above, but played to the Axis camera with id “cam1”:
 +
 +
TIME : audio axis@cam1 = file "audio/gong.mp3"
 +
 +
Converts a text message to speech using the “en” voice of the text-to-speech engine, and play the audio on an Axis camera:
 +
 +
TIME : audio axis@cam1 = "voice:en" “the time is “ $time:h:m$
 +
 +
Same as above, but played by web browser with Acapela "Ryan" voice:
 +
 +
TIME : audio web = "voice:ryan22k" "the time is " $time:h:m$
  
 
== Serial Communication Ports ==
 
== Serial Communication Ports ==
 
=== COMM ===
 
=== COMM ===
 +
 +
Sends a sequence of bytes to the specified communication port.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| COMM name = hexbytes
 +
| sends bytes to a serial port
 +
|}
 +
 +
 +
{{tip|If both verboseLog and userLog are set to true, the full trace of sent bytes is written to the log file.}}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - the name of the communications port, as defined in the CommPorts parameter in hsyco.ini
 +
* hexbytes - string with the hexadecimal representation of the sequence of bytes to be sent. You can use multiple unquoted words, quoted strings and variables, that will be appended to generate the byte stream sent to the communication port.
 +
 +
 +
'''Examples:'''
 +
 +
COMM serialport =  FE03C9104B27
 +
COMM serialport =  FE $body 27
  
 
== Squeezebox ==
 
== Squeezebox ==
 
=== MUSIC ===
 
=== MUSIC ===
 +
 +
Controls the Squeezebox players.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| MUSIC address =  ON
 +
| turns the player on
 +
|-
 +
| MUSIC address = OFF
 +
| turns the player off
 +
|-
 +
| MUSIC address = PLAY
 +
| starts playing music in the active playlist
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* address - player number, starting from 0 for the first player, based on the listing order of the slimPlayers parameter in hsyco.ini.
 +
 +
 +
'''Examples:'''
 +
 +
MUSIC 0 = ON
 +
MUSIC 1 = PLAY
  
 
== User Interface ==
 
== User Interface ==
 
=== UISESSIONSET ===
 
=== UISESSIONSET ===
 +
 +
Changes the dynamic attributes of an identified GUI object, just like UISET, but only affects the client session that generated the event that triggered this action.
 +
 +
UISESSIONSET can only be used with PAGE and USER events, and will override settings made with UISET.
 +
 +
{| class="wikitable"
 +
| width=200 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| UISESSIONSET id.attr = value
 +
| id is the unique name that identifies the object, specified in the index.hsm file with the extension  !id after the object type
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* id - object id
 +
* attr - attribute name
 +
* value - attribute value. You can use multiple unquoted words, quoted strings and variables, that will be appended to form the value parameter.
 +
 +
 +
'''Examples:'''
 +
 +
USER mybutton = 1 : UISESSIONSET mytext.style = italic
 +
 
=== UISET ===
 
=== UISET ===
 +
 +
Changes the dynamic attributes of an identified GUI object.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| UISET id.attr = value
 +
| id is the unique name that identifies the object, specified in the index.hsm file with the extension  !id after the object type
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* id - object id
 +
* attr - attribute name
 +
* value - attribute value. You can use multiple unquoted words, quoted strings and variables, that will be appended to form the value parameter.
 +
 +
 +
'''Examples:'''
 +
 +
UISET mytext.style = italic
 +
UISET mychart.barcolor =”#000000”
 +
 
=== USER ===
 
=== USER ===
 +
 +
Triggers a USER event and the userCommand(String name, String param) Java method and JavaScript function.
 +
 +
Can be used like a function call in EVENTS, and as a calling mechanism between EVENTS, JavaScript and Java.
 +
 +
{| class="wikitable"
 +
| width=160 | '''Action'''
 +
| '''Description'''
 +
|-
 +
| USER name = param
 +
|
 +
executes the  userCommand(name, param) Java method and JavaScript function, and the USER name = param event.<br>
 +
Either name or param can be omitted, and will be passed as empty strings, but not both
 +
|}
 +
 +
 +
'''Parameters:'''
 +
 +
* name - passed as the name parameter to USER and userCommand(). You can use multiple unquoted words, quoted strings and variables, that will be appended to form the name parameter
 +
* param - passed as the param parameter to USER and userCommand(). You can use multiple unquoted words, quoted strings and variables, that will be appended to form the param parameter.
 +
 +
 +
'''Examples:'''
 +
 +
USER hometheater = "on"
 +
USER hometheater = "changed" $newvalue

Latest revision as of 10:33, 1 September 2015

An action is defined as a keyword that identifies the action type, always followed by one or more parameters and sometimes the equal (assignment) operator.

Every keyword uses a specific syntax that interprets parameters according to its own rules.

System Keywords

DATESET

Set the HSYCO Server’s system clock.

Action Description
DATESET = datetime set the HSYCO Server operating system’s clock and hardware clock


Parameters:

  • datetime - date and time formatted as "YYYY-MM-DD hh:mm:ss" or "YYYYMMDDhhmmss", in the local time zone


Examples:

DATESET "2014-10-31 20:00:00"
DATESET "20141031200000"

HAACTIVE

Force a master HSYCO server to become inactive, or return to the active state.

Action Description
HAACTIVE = false force a master to become inactive (has no effect on the slave system)
HAACTIVE = true used after the master was forced to become inactive, returns it to the active state (has no effect on the slave system)


Parameters:

  • active - true or false


Examples:

IO mygate.connection = offline : HAACTIVE = false

POWER

Sets the electric power state variable.

The power value is shown in the navigation or status bar of the Web interface.

Besides setting the power value, this method also triggers the execution of the powerEvent() callback and the POWER event in EVENTS.

Action Description
POWER = power sets the electric power state variable to a specific value, in Watts


Parameters:

  • power - the power in Watt units.


Examples:

POWER = IO meter.power

PROGRAMTIMER

Creates or deletes a program timer.

Action Description
PROGRAMTIMER name = SET seconds

a program timer will be executed after the number of seconds specified in SET.
If a program timer with the same name has already been set, the action will be ignored

PROGRAMTIMER name = CLEAR deletes a timer
PROGRAMTIMER name = RESET seconds similar to SET, but if a program timer with the same name has already been set, the timer settings will be changed to the new timeout
PROGRAMTIMER name = REPEAT seconds sets a program timer that is executed repeatedly with an interval equal to the specified number of seconds


Parameters:

  • name - the program timer name
  • seconds - the timeout, in seconds.


Examples:

SECURITY evo = ON 1  : PROGRAMTIMER presence = REPEAT 3600
SECURITY evo = OFF 1 : PROGRAMTIMER presence = CLEAR

WAIT

Pauses before the execution of the next action.

Action Description
WAIT = s

causes a pause in the execution of actions for the specified number of seconds.
It can be also set in decimal format


Parameters:

  • s - wait time in seconds


Examples:

WAIT = 5
WAIT = 0.3

Cameras

CAMERA

The CAMERA action is used to temporarily disable cameras’ live view and recording features.

Action Description
CAMERA name = ON live view enabled
CAMERA name = OFF live view and recording disabled
CAMERA name = RECON recording enabled
CAMERA name = RECOFF recording disabled


Parameters:

  • name - the camera’s id. You can specify a list of space separated ids.


Examples:

  • CAMERA entrance = ON

CAMERAREC

Records video from a camera.

Action Description
CAMERAREC name = sec records for the number of seconds defined with the set attribute


Parameters:

  • name - the camera’s id. You can specify a list of space separated ids
  • sec - recording time in seconds. If set to 0, stops the current recording.


Examples:

CAMERAREC openspace = 30

CAMERARECFULL

Records video from a camera, like CAMERAREC, but ignores the DroppedFrames parameter in hsyco.ini, so that all frames captured from the camera during the recording period are recorded with no skips.

Action Description
CAMERARECFULL name = sec records for the number of seconds defined with the set attribute


Parameters:

  • name - the camera’s id. You can specify a list of space separated ids
  • sec - recording time in seconds. If set to 0, stops the current recording.


Examples:

CAMERARECFULL openspace = 30

Data Logger

Data loggers collect and display statistical data on the variation of a specified value.

They can be used to automatically generate trend charts and log the data as CSV files.

See the Data Logger documentation for additional information.

DATALOGGER

Updates and performs operations on a data logger.

Action Description
DATALOGGER name = value

Supplies the data logger with a new value to be processed.
It will also trigger the refresh procedure

DATALOGGER name = CLEAR Clears the data gathered in the data logger
DATALOGGER name = ERROR Used with counter data loggers, resets the internal delta baseline
DATALOGGER name = FILE LOG filename [TIMESTAMP]

Appends the last acquired value to the specified file (filename) using the CSV format.
If the option TIMESTAMP is specified, the timestamp of the record will be reported too

DATALOGGER name = FILE STAT filename Creates or updates the specified file (filename) with the currently gathered data using the CSV format


Parameters:

  • name - identifier of the data logger. It is possible to use a list of names separated by spaces to address several data loggers. Variables can be used
  • filename - the file pathname. You can use multiple distinct strings, including variables, that will be concatenated to create the file name.


Examples:

$value : DATALOGGER energy = $value,
  DATALOGGER energy = FILE LOG userdata/energylog.csv TIMESTAMP,
  DATALOGGER energy = FILE STAT userdata/energystat.csv
TIME : DATALOGGER temperature = IO ste.1
TIME : DATALOGGER humidity = IO ste.2

DMX

DMX

Controls the value of DMX-512 channels.

Action Description
DMX address = ON sets the DMX address to the value preceding the last OFF command
DMX address = OFF sets the DMX address to value = 0
DMX address = FLIP

flips the status of a DMX channel (if the status is ON it executes the OFF command and vice versa).
When more channels are specified, if the previous status of at least one of the channels is different from OFF, the OFF command will be sent to all the channels, otherwise the ON command will be sent

DMX address = value

assigns a value to the DMX channel.
Valid values are numbers between 0 and 255

DMX addressX = DMX addressY the DMX channel addressX assumes the current status of the DMX channel addressY
DMX address = MERGE the channel or channels on the DMX OUT bus of the gateway follow the same channels of the DMX IN bus
DMX address = UNMERGE disables merge mode


Parameters:

  • address - when using one DMX gateway, address will be a standard DMX-512 address between 1 and 512. If there is more than one gateway, 1000 must be added to the DMX address for the second gateway, 2000 for the third one and so on. For example, 2100 stands for the address 100 on the DMX bus controlled by the third gateway. You can also use a from-to range format to specify a contiguous block of channels.


Examples:

DMX 100 101 102 = ON
DMX 100-120  200-220 = DMX 40
DMX 33 = MERGE

Infrared Control

IR

Sends a command to an IRTrans.

Action Description
IR name = command the IR code must be in the local IRTrans FLASH memory database or, If the hsyco/ir directory contains a .ccfhex file corresponding to the database name, then the CCF string in that file is used instead of sending the command stored in the IRTrans internal database


Parameters:

  • name - identifies the IRTrans, as defined with the IRTrans parameter in hsyco.ini
  • command - the command format is remote.command; that is the remote control database name followed by a dot and the command name.


Examples:

IR theater = dvd.play

I/O Servers

IO

Writes to I/O servers data points.

Action Description
IO name = value

sets the data point to a value.
Values are specific to the type of I/O server

IO name = FLIP inverts the output of the I/O data point. If the status of the output is 0 the new status will be 1, if different from 0 the new status will be 0
IO name1 = IO name2 sets the I/O interface output name1 to the current value of the I/O interface name2


Parameters:

  • name - the server id, followed by a single dot and the data point suffix. The EVENTS interpreter converts data points names to lower case
  • value - you can use multiple unquoted words, quoted strings and variables, that will be appended to the value string.


Examples:

IO contacts.c1 contacts.c3= 1
IO sensors.c1 = FLIP
IO contacts.o1 contacts.o2 = IO sensors.flood

Leak Detector

The Intelligent Leak Detector is used to generate warning for potential water or other quantities leaks by analyzing any generic flow counter.


The detector should be called at regular intervals, possibly faster than the minimum time needed for the counter to increment its value by one.

It will generate a leak warning when the measured flow remains relatively constant over a certain amount of time.


Note Use this function at your own risk!


The Intelligent Leak Detector uses a correlation algorithm to distinguish between a constant flow and an irregular flow. A relatively constant flow over a certain amount of time is considered as a potential leak and generates a leak event.

In some conditions, also depending on the type of flow counter used, this algorithm could fail from properly and timely recognizing a real leak, or it could generate false leak warnings.

Note Use different names to implement multiple independent leak detectors.


LEAK

Controls the integrated leak detector.

The detector’s logic uses two parameters to set its sensitivity and time base.

The detector generates a warning if the flow deviation constantly remains below the deviation threshold for the time period.

You can change the defaults to adapt to your specific conditions.

Action Description
LEAK name = value

calls the leak detector passing the current liters counter value.
Using variables or references to IO data points is supported

LEAK name = PERIOD t

changes the time base. The default is 1200 seconds.
Set the period to 0 to temporarily disable the detector.
The time base can be changed anytime, even when the detector is already processing data

LEAK name = DEVIATION d

changes the deviation percentage. d should be a number between 1 and 100. The default is 50.
Set the deviation to 0 to temporarily disable the detector.
Lower values cause the algorithm to activate leak warnings only when the flow is very constant in time, becoming less susceptible to false alarms, but a value that is too low could miss actual leaks. Higher values could easily generate false alarms.
The deviation can be changed anytime

LEAK name = CLEAR

clears the detector’s internal state.
In normal applications, there is no need to call this function, as the detector automatically clears its state from old data


Parameters:

  • name - the name of a leak detector. Using different names you can implement several independent leak detectors
  • t - time base
  • d - deviation percentage


Examples:

HSYCOSTART : PROGRAMTIMER modbusread = repeat 4
PROGRAMTIMER modbusread :  IO modbus.2.768 = readholdingregisters:uint, LEAK water = IO modbus.2.768
LEAK water = ON : MAIL "john@example.com" = "hsyco@example.com" "Urgent Message from HSYCO" "Leak Detected"
LEAK water = OFF : MAIL "john@example.com" = "hsyco@example.com" "Message from HSYCO" "Leak Reset"

Log

FILELOG

Appends a generic text message at the end of a file.

Action Description
FILELOG filename = text you can use multiple unquoted words, quoted strings and variables, that will be appended at the last line of the text file


Parameters:

  • filename - the file name. You can specify any path, starting from HSYCO’s base directory. If the file or parent directories don’t exist, they will be created automatically. The filename parameter can be a variable
  • text - the message that will be appended at the last line of the text file.


Examples:

HSYCOSTART : FILELOG logs/mylog.txt = "log message example"

LOG

Generates an information message in the daily log file.

Action Description
LOG = text you can use multiple unquoted words, quoted strings and variables, that will be appended to the log message


Parameters:

  • text - the log message
  • from - the sender e-mail address.


Examples:

LOG = "log message example"
LOG = "Time: " $TIME:H-M-S$ " DATE: " $DATE:D/M/Y$

Mail

MAIL

Sends an email message.

HSYCO SERVER sends the mail either directly to the recipient’s domain mail server if the SmtpName parameter is not defined in hsyco.ini, or using a specific email account with user authentication and traffic encryption if the SMTP server and account parameters are set.

If the email message is sent directly to the recipient’s domain mail server, you need to ensure that the mail server accepts mail to the destination address being sent with the from address and the public IP of the HSYCO SERVER.

Note HSYCO does not automatically retry sending the message if the destination mail server is not available when the send mail function is called.


Action Description
MAIL to = from subject body

sends text and camera images.
The body part of the mail is the last attribute. You can email the same message to multiple recipients


Parameters:

  • to - the recipient address. It is possible to send the same email to a space separated list of email addresses. You can optionally specify the destination SMTP server name or IP address by appending :server name or address to the recipient's email address, for example: john@example.com:192.168.1.1
  • from - the sender e-mail address
  • subject - a quoted string or variable with the message object
  • body - the message body. To send an ordinary text, just enter a quoted text string. To send an image, append strings with the following format: “cam:cameraname[:seconds_back]”. For example, “cam:door” sends a live frame from the camera called “door”; “cam:door:2” sends a frame that was recorded two seconds before the last recorded frame; “cam:door:0” sends the last recorded frame. To send files as attachments, use the following format: “file:file name”. The file path is relative to the HSYCO root directory.


Examples:

In this example, we send a message every minute, with the measured power load, to two email addresses:

TIME : $BODY = "Energy consumption for " $DATE:y/m/d$ " at " $TIME:h:m:s$ " is " $power$ " Watt"
$BODY : MAIL email1@hsyco.com email2@hsyco.com = hsyco@hsyco.net “Sent from HSYCO” $BODY

40 seconds after the alarm event, an email from the address hsyco@hsyco.net is sent to emal1@hsyco.com, with three images attached: the first is a real time image, the second is the last recorded image, the third one is the frame that was recorded 15 seconds before:

user "security" = "alarm" : CAMERAREC entrance = 30, PROGRAMTIMER rec = 40
PROGRAMTIMER rec : MAIL email1@hsyco.com = hsyco@hsyco.net “Sent from HSYCO” “Camera entrance” “cam:entrance” “cam:entrance:0” “cam:entrance:15”

At midnight, we are sending the energy.csv file in the data sub-directory as an attachment:

TIME = 0000: MAIL email1@hsyco.com = hsyco@hsyco.net "Sent
from HSYCO” "Energy daily report." file:data/energy.csv

Network Services

PING

Tests the reachability of one or more hosts, identified by their hostnames or IP addresses, within the optional timeout defined in milliseconds (or using a default timeout of 200 ms).

This test generates PING events like PING hostname = ON if the host is reachable, or PING hostname = OFF if not reachable.

Action Description
PING hostname test the reachability of hostname, with 200ms response time-out
PING hostname = time test the reachability of hostname, with a specific response time-out


Parameters:

  • hostname - the IP device name or IP address
  • time - response time-out, in milliseconds.


Examples:

TIME : PING 192.168.1.1
TIME : PING 192.168.1.200 192.168.1.201 = 1000

URL

Sends a GET or POST HTTP or HTTPS request to the specified url.

The HTTP basic or digest access authentication methods are supported.

Responses can be checked using the corresponding URL event.

Action Description
URL GET "url" sends a GET request without authentication
URL GET "user:password" "url" sends a GET request with authentication
URL POST "url" "content_type" "data" sends a POST request without authentication
URL POST "user:password" "url" "content_type" "data" sends a POST request with authentication


Parameters:

  • url - a full url, including the mandatory http:// or https:// query scheme and optional query string
  • user:password - user and password for basic or digest access authentication
  • content_type - the MIME type descriptor for the POST data
  • data - the URL-encoded POST data sent with the request.


Examples:

HSYCOSTART: URL POST "http://10.0.0.5/cgi-bin/cmd.sh" "text/xml" "%3C%3Fxml%20version%3D%22..."	
TIME 0800: URL GET "usr1:qi3qw" "http://10.0.0.5/cgi-bin/cmd.sh?id=relay1"
URL "http://10.0.0.5/cgi-bin/cmd.sh?id=relay1" : LOG = "relay opened"

Public Announcement

AUDIO

The AUDIO action is used to play text-to-speech messages or recorded audio files.

Audio can be sent to the Web browser, the server’s audio line out connector, the internal speaker or audio out line of Axis cameras, SNOM's phones or PA devices, and I/O servers with audio playback capabilities.

See the Audio and Public Announcement section for additional information.

Action Description
AUDIO to = FILE filename plays a pre-recorded audio file
AUDIO to = VOICE:voicename message converts a text message to speech and plays the audio


Parameters:

  • to - the audio destination (see table below)
  • filename - the pathname of the audio file, relative to the HSYCO’s main directory
  • voicename - the voice name for the text-to-speech engine; see the Audio and Public Announcement section for additional information
  • message - the text message for text-to-speech conversion; you can use multiple strings that will be automatically appended.


Audio Destination Description
speaker the server’s audio line out connector
web the Web browser’s audio output
Note this feature is supported only on Firefox and Chrome browsers
axis@camera id audio sent to an Axis camera, using the camera id defined in the Cameras parameter in hsyco.ini
axis@host name audio sent to an Axis geric audio device. Use the host name or IP address of the device. The device must allow anonymous commands via HTTP on the default port 80
snom@ip:port audio sent to SNOM phones and public announcement devices, to the multicast IP address and port specified (the IP address and port should be configured as multicast addresses on each phone)
io@I/O server id[.zone id] audio sent to I/O servers with audio playback capabilities, e.g. the Sonos I/O server


Examples:

The gong.mp3 audio file is played every minute through the server’s audio line out or internal speaker:

TIME : audio speaker = file "audio/gong.mp3"

Same as above, but played at the same time on all phones registered to the 239.255.255.245 multicast address and port 5555:

TIME : audio snom@239.255.255.245:5555 = file "audio/gong.mp3"

Same as above, but played to the Axis camera with id “cam1”:

TIME : audio axis@cam1 = file "audio/gong.mp3"

Converts a text message to speech using the “en” voice of the text-to-speech engine, and play the audio on an Axis camera:

TIME : audio axis@cam1 = "voice:en" “the time is “ $time:h:m$

Same as above, but played by web browser with Acapela "Ryan" voice:

TIME : audio web = "voice:ryan22k" "the time is " $time:h:m$

Serial Communication Ports

COMM

Sends a sequence of bytes to the specified communication port.

Action Description
COMM name = hexbytes sends bytes to a serial port


Note If both verboseLog and userLog are set to true, the full trace of sent bytes is written to the log file.


Parameters:

  • name - the name of the communications port, as defined in the CommPorts parameter in hsyco.ini
  • hexbytes - string with the hexadecimal representation of the sequence of bytes to be sent. You can use multiple unquoted words, quoted strings and variables, that will be appended to generate the byte stream sent to the communication port.


Examples:

COMM serialport =  FE03C9104B27
COMM serialport =  FE $body 27

Squeezebox

MUSIC

Controls the Squeezebox players.

Action Description
MUSIC address = ON turns the player on
MUSIC address = OFF turns the player off
MUSIC address = PLAY starts playing music in the active playlist


Parameters:

  • address - player number, starting from 0 for the first player, based on the listing order of the slimPlayers parameter in hsyco.ini.


Examples:

MUSIC 0 = ON
MUSIC 1 = PLAY

User Interface

UISESSIONSET

Changes the dynamic attributes of an identified GUI object, just like UISET, but only affects the client session that generated the event that triggered this action.

UISESSIONSET can only be used with PAGE and USER events, and will override settings made with UISET.

Action Description
UISESSIONSET id.attr = value id is the unique name that identifies the object, specified in the index.hsm file with the extension !id after the object type


Parameters:

  • id - object id
  • attr - attribute name
  • value - attribute value. You can use multiple unquoted words, quoted strings and variables, that will be appended to form the value parameter.


Examples:

USER mybutton = 1 : UISESSIONSET mytext.style = italic

UISET

Changes the dynamic attributes of an identified GUI object.

Action Description
UISET id.attr = value id is the unique name that identifies the object, specified in the index.hsm file with the extension !id after the object type


Parameters:

  • id - object id
  • attr - attribute name
  • value - attribute value. You can use multiple unquoted words, quoted strings and variables, that will be appended to form the value parameter.


Examples:

UISET mytext.style = italic
UISET mychart.barcolor =”#000000”

USER

Triggers a USER event and the userCommand(String name, String param) Java method and JavaScript function.

Can be used like a function call in EVENTS, and as a calling mechanism between EVENTS, JavaScript and Java.

Action Description
USER name = param

executes the userCommand(name, param) Java method and JavaScript function, and the USER name = param event.
Either name or param can be omitted, and will be passed as empty strings, but not both


Parameters:

  • name - passed as the name parameter to USER and userCommand(). You can use multiple unquoted words, quoted strings and variables, that will be appended to form the name parameter
  • param - passed as the param parameter to USER and userCommand(). You can use multiple unquoted words, quoted strings and variables, that will be appended to form the param parameter.


Examples:

USER hometheater = "on"
USER hometheater = "changed" $newvalue