GetEvent

 

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)
ev.phone_event = phone event number. Values are:

0 = On first ring from outside
1 = On each ring from outside
2 = On first ring from inside
3 = On each ring from inside
4 = On Caller ID available
5 = On answer outside
6 = On answer inside
7 = On message left
8 = On message read

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
ev_trig_dc
= X10 command that device must change to

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
ev_trig_dc
= X10 command that device must change to
ev_time
= value to match

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
DAY_TUE = &H2

DAY_WED = &H4

DAY_THU = &H8

DAY_FRI = &H10

DAY_SAT = &H20

DAY_SUN = &H40

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:

SEND_EMAIL = &H1

Send an E-mail notification

SMART_ON = &H2

Only send ON/DIM/BRIGHT if X10 device is OFF

ALL_MAIL = &H4

All received mail causes trigger

VOICE_COMMAND = &H8

Voice command is enabled

DEL_AFTER_TRIG = &H10

Delete the event after it triggers

DISABLED = &H20

1=Event is disabled

HIDE = &H40

1=This event does not show in views

APPLY_COND = &H80

1=Apply conditions settings to trigger

ANY_X10 = &H100

1=Any x10 command caused trigger if trig type is x10

SMART_GROUP = &H200

1=Groups devices together when sending X10 commands

REC_REF_HOUR = &H400

1=Recurring minutes are referenced from the hour (recurring trigger type only)

GUESTS_CAN_TRIGGER = &H800

1=Users who login to the web site as guests can trigger this event

SECURITY = &H1000

1 = Vary trigger time by +-30 minutes randomly

NO_RETRIGGER = &H2000

(This is no longer used - see retrigger_delay)

EVNO_LOG = &H4000

1= Do not log for this event

 

misc2

long

More various flags to control actions. They are:

VOICE_PHONE_COMMAND = &H1

1 = voice command works over the phone

VOICE_CONFIRM = &H2

1 = voice command in event must be confirmed

CHECK_CONDITIONS = &H4

1 = when triggering other events, apply conditions

SCRIPT_SINGLE_INSTANCE = &H8

1 = only one copy of the script may run when the event triggers

DELAYED_ACTION = &H10

1 = set if the event was dynamically created due to a delayed action

REC_REF_HOUR_ONCE = &H20

1 = for recurring events, only trigger once after the hour

SPEAK_ASYNC = &H40

1 = speak TTS in the background

INCLUDE_PF = &H80

1 = include this event in power failure recovery

 

 

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)
There are two types of conditions, time based and device based. This property defines the type.

Public Const COND_TYPE_TIME = 0
Public Const COND_TYPE_DEVICE = 1

condition (integer)
For each type above, there are various conditions. For time conditions, this property can be one of the following:

COND_BEFORE_SUNSET = 0
COND_AFTER_SUNSET = 1

COND_BEFORE_SUNRISE = 2

COND_AFTER_SUNRISE = 3

COND_BEFORE_SUNSET_OFFSET = 4

COND_AFTER_SUNSET_OFFSET = 5

COND_BEFORE_SUNRISE_OFFSET = 6

COND_AFTER_SUNRISE_OFFSET = 7

COND_AT = 8

COND_BEFORE = 9      ' before a time

COND_AFTER = 10      ' after a time

COND_DAY = 11

COND_NIGHT = 12

For device conditions, it must be one of the following:

COND_IS_ON = 0
COND_IS_OFF = 1

COND_HAS_BEEN_ON = 2

COND_HAS_BEEN_OFF = 3

COND_X10_ON = 4

COND_X10_OFF = 5

COND_X10_DIM = 6

COND_X10_BRIGHT = 7

COND_HAS_BEEN_ON_MORE = 8

COND_HAS_BEEN_OFF_MORE = 9

COND_X10_ANY = 10

COND_VALUE_EQUALS = 11

 

dev_ref (single)
For device conditions, the condition refers to a particular device. Each device has a unique reference number. You can use the device functions to find the particular device, get its reference number, and load it here in this property.

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)
This is the reference id for the device to control. Each device has a unique ID that can be obtained with the device functions.

dim_percent (integer)
The dim value to dim or bright the device to. The range is 0-100.

dimto (integer)
0=relative 1=Absolute 2=Absolute bright to 100% first

func (integer)
The X10 function to send to the device.

secs_delay (long)
The time in seconds to delay before sending the requested command to the device.

new_string (string)
The string to set the device to when the action is performed. The new string will be displayed as the device's status.

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

 

EventCount