Difference between revisions of "Action Keywords"
Line 254: | Line 254: | ||
| DATALOGGER name = FILE STAT filename | | DATALOGGER name = FILE STAT filename | ||
| Creates or updates the specified file (filename) with the currently gathered data using the CSV format | | Creates or updates the specified file (filename) with the currently gathered data using the CSV format | ||
− | |} | + | ||- |
+ | | DATALOGGER name = FILE CSVWRITE filename | ||
+ | | Writes a raw dump of all data of a data logger into a CSV file. The file, named <data logger id>.csv is written in the <path> directory | ||
+ | } | ||
Revision as of 13:06, 13 February 2017
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.
Contents
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. |
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. |
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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 |
Appends the last acquired value to the specified file (filename) using the CSV format. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DATALOGGER name = FILE LOG filename TIMESTAMP |
Appends the last acquired value to the specified file (filename) using the CSV format. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DATALOGGER name = FILE STAT filename | Creates or updates the specified file (filename) with the currently gathered data using the CSV format | - | DATALOGGER name = FILE CSVWRITE filename | Writes a raw dump of all data of a data logger into a CSV file. The file, named <data logger id>.csv is written in the <path> directory
}
$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 DMXDMXControls the value of DMX-512 channels.
DMX 100 101 102 = ON DMX 100-120 200-220 = DMX 40 DMX 33 = MERGE Infrared ControlIRSends a command to an IRTrans.
IR theater = dvd.play I/O ServersIOWrites to I/O servers data points.
IO contacts.c1 contacts.c3= 1 IO sensors.c1 = FLIP IO contacts.o1 contacts.o2 = IO sensors.flood Leak DetectorThe Intelligent Leak Detector is used to generate warning for potential water or other quantities leaks by analyzing any generic flow counter.
It will generate a leak warning when the measured flow remains relatively constant over a certain amount of time.
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. Use different names to implement multiple independent leak detectors.
LEAKControls 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.
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" LogFILELOGAppends a generic text message at the end of a file.
HSYCOSTART : FILELOG logs/mylog.txt = "log message example" LOGGenerates an information message in the daily log file.
LOG = "log message example" LOG = "Time: " $TIME:H-M-S$ " DATE: " $DATE:D/M/Y$ 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. HSYCO does not automatically retry sending the message if the destination mail server is not available when the send mail function is called.
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 ServicesPINGTests 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.
TIME : PING 192.168.1.1 TIME : PING 192.168.1.200 192.168.1.201 = 1000 URLSends 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.
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 AnnouncementAUDIOThe 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.
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 PortsCOMMSends a sequence of bytes to the specified communication port.
COMM serialport = FE03C9104B27 COMM serialport = FE $body 27 SqueezeboxMUSICControls the Squeezebox players.
MUSIC 0 = ON MUSIC 1 = PLAY User InterfaceUISESSIONSETChanges 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.
USER mybutton = 1 : UISESSIONSET mytext.style = italic UISETChanges the dynamic attributes of an identified GUI object.
UISET mytext.style = italic UISET mychart.barcolor =”#000000” USERTriggers 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.
USER hometheater = "on" USER hometheater = "changed" $newvalue |