|
Parameter |
Type |
Description |
|
index |
integer |
Index of desired event |
|
Return value |
Type |
Description |
|
|
EventClass |
|
Returns an event. The event is of type "EventClass" and can be used to retrieve and set properties of an event. The following code will iterate through all events and display their names.

An EventClass has a number of properties that holds information about an event. You can access these properties to get and set this information. The function "NewEvent()" can be used to create a new empty event. The properties of the event are listed below.
EventClass Object
|
Property |
Type |
Description | ||||||||||||||||||||||||||||||
|
name |
string |
The name given to the event | ||||||||||||||||||||||||||||||
|
ev_time |
string |
Specifies the absolute time the event will trigger. Only valid for event type TYPE_TIME. | ||||||||||||||||||||||||||||||
|
vcmd |
string |
The voice command for the event | ||||||||||||||||||||||||||||||
|
ev_abs_time |
integer |
The type of event. The following types are defined. time = 0, The event triggers at an absolute time. The property ev_time must contain a valid time. sunrise = 1, The event triggers at sunrise. The property ev_offset may be used to specify an offset from sunrise. Before or after is specified in ev_offset_before. sunset = 2, The event triggers at sunset. The property ev_offset may be used to specify an offset from sunset. Before or after is specified in ev_offset_before. X10 = 3, The event triggers on reception of an X10 command. The property ev_trig_hc must contain the X10 housecode, ev_trig_dc must contain the X10 devicecode, and ev_trig_func must contain the X10 command. condition = 4, The event triggers when the given condition is true. The property ev_conditions must contain at least one condition. E-mail = 5, The event triggers on reception of E-mail, either from a POP mail account or MAPI. The property pop_from must contain the E-mail address to check for. recurring = 6, The event is a recurring event and recurs at the interval set in the property rec_secs. manual = 7, The event can only be triggered manually by the web page or menu. If a voice command is set for the event, voice commands will still trigger the event as long as its enabled. irmatch = 8, The event triggers by a match on infrared received. The “irmatch” property holds the infrared number to match. security = 9, security panel event, only the Napco supports this event. phone = 10, The event triggers on a match from a phone event (HomeSeer Phone). The action parameters are stored in the ev.phone_actions property. The trigger is held in: ev.phone_line =
phone line to trigger on (1 or 2) 0 = On first ring from outside 9 = Handset Off Hook 10 = Handset On Hook * on/off hook events are only supported with hardware that can generate these events status change = 11, The event triggers on the change of status of a device. Paramaters are: ev_trig_hc
= reference # of device that will change status value change = 12, The event triggers on a change of value of a device. Parameters are: ev_trig_hc
= reference # of device that will change status | ||||||||||||||||||||||||||||||
|
phone_actions |
string |
Holds the actions for a phone trigger. The actions are stored as a string separated with a “:” in the format: change rings enable (0 or 1) [:] number of rings to change to [:] phone line number [:] change greeting enable (0 or 1) [:] new greeting | ||||||||||||||||||||||||||||||
|
ev_app_path |
string |
A path to an application that will be launched when the event is triggered. Set to an empty string to be ignored. | ||||||||||||||||||||||||||||||
|
ev_date |
string |
The date the event will trigger. Only valid for "TYPE_TIME" events. | ||||||||||||||||||||||||||||||
|
ev_days |
integer |
A bitmap specifying which days the event may trigger. Only valid for "TYPE_TIME" events. The bits are as follows: DAY_MON
= &H1 | ||||||||||||||||||||||||||||||
|
ev_func |
integer |
The global X10 command to execute when the event triggers. This is used for "ALL_LIGHTS_ON, ALL_UNITS_OFF" commands. Set to "NO_X10" or 17 to do nothing. The property ev_hc must be set to the proper housecode. | ||||||||||||||||||||||||||||||
|
ev_hc |
integer |
Used with ev_func to send global X10 commands (housecode wide). Set this property to housecode you wish to send the command on. | ||||||||||||||||||||||||||||||
|
ev_mail_message |
string |
The message body for E-mail notifications. Only valid if event action is set to "MISC_SEND_EMAIL". See ev_misc. | ||||||||||||||||||||||||||||||
|
ev_mail_subj |
string |
The subject of the message for E-mail notifications. Only valid if event action is set to "MISC_SEND_EMAIL". See ev_misc. | ||||||||||||||||||||||||||||||
|
ev_offset |
integer |
Used with trigger type TYPE_SUNRISE and TYPE_SUNSET. A positive value that is either added or subtracted from sunrise or sunset depending on the value of ev_offset_before. | ||||||||||||||||||||||||||||||
|
ev_offset_before |
boolean |
If true, ev_offset is subtracted from sunrise/sunset to get the trigger time, if false, ev_offset is added to sunrise/sunset to get the trigger time. | ||||||||||||||||||||||||||||||
|
retrigger_delay |
integer |
This sets the number of seconds before the event can be retriggered. | ||||||||||||||||||||||||||||||
|
ev_trig_hc |
string |
The housecode that will trigger the event when the trigger type is TYPE_X10. | ||||||||||||||||||||||||||||||
|
ev_trig_dc |
string |
The devicecode that will trigger the event when the trigger type is TYPE_X10. A value of "17" may be set to indicate ANY device on the given housecode. | ||||||||||||||||||||||||||||||
|
ev_trig_func |
integer |
The X10 command that will cause the event to trigger. Used with ev_trig_hc and ev_trig_dc and trigger type TYPE_X10. | ||||||||||||||||||||||||||||||
|
ev_wav_path |
string |
The path to a ".wav" sound file that will be played with the event triggers. Set to an empty string to be ignored. | ||||||||||||||||||||||||||||||
|
events |
string |
A list of events to trigger. The list is a comma-separated list of event names. Set to an empty string to be ignored. | ||||||||||||||||||||||||||||||
|
ir |
|
The ir commands to be sent to the infrared device. | ||||||||||||||||||||||||||||||
|
mail_attach_path |
string |
A path to a file to attach to outgoing E-mail notifications. Set to an empty string for no attachments. | ||||||||||||||||||||||||||||||
|
misc |
long |
Various control flags as bits in the long value. Bits are defined as:
| ||||||||||||||||||||||||||||||
|
misc2 |
long |
More various flags to control actions. They are:
| ||||||||||||||||||||||||||||||
|
popfrom |
string |
Email address that must match for event to trigger. Only valid if trigger mode is TYPE_POP_MAIL. | ||||||||||||||||||||||||||||||
|
rec_secs |
integer |
Number of seconds between triggers for events of trigger type TYPE_RECURRING. | ||||||||||||||||||||||||||||||
|
scripts |
string |
A list of scripts that will run when the event triggers. The list is a comma-separated list of script names. Set this to an empty string for no scripts. | ||||||||||||||||||||||||||||||
|
speech |
string |
The string to be spoken when the event triggers. Set to an empty string for no speech. | ||||||||||||||||||||||||||||||
|
security_offset |
integer |
An offset that is added to the given trigger time. This offset is randomly generated for security mode. | ||||||||||||||||||||||||||||||
|
ev_conditions |
collection |
This is a collection of "condition classes". Each entry defines a condition that must be true before the event will trigger. All conditions must be true. The trigger type must be set to TYPE_CONDITION. See NewCondition for information on creating new entries. The condition class has the following properties: ctype (integer) Public
Const COND_TYPE_TIME = 0 condition (integer) COND_BEFORE_SUNSET
= 0 For device conditions, it must be one of the following: COND_IS_ON
= 0 COND_X10_ANY = 10 COND_VALUE_EQUALS = 11
dev_ref (single) | ||||||||||||||||||||||||||||||
|
time |
string |
For time based conditions, this property holds time values as a sting like: 4:20 pm. Hours and minutes of duration are set to values like: 2:30 | ||||||||||||||||||||||||||||||
|
ev_devices |
collection |
This is a collection of classes of type "devfunc". This is a list of devices that the event controls. See NewDevfunc and NewCondition for information on creating new entries. The devfunc class has the following properties: devid (single) dim_percent (integer) dimto (integer) func (integer) secs_delay (long) new_string (string) | ||||||||||||||||||||||||||||||
|
group |
string |
The name of the group the event belongs to |
Note
Use caution when working with the event class properties directly. Internally, HomeSeer will compare (for example) an event name from the event class to the event name provided in a script command by making both lower case or both upper case. When you access the event class directly, you are getting the event name exactly as it was entered by the user. If you are using Visual Basic, use Trim(), UCase() or LCase() when comparing values of string properties.
Example
The following script shows how to reiterate though all events, get the event name, and reiterate though all the devices the event controls.

See also