« Back to Product

Documentation

IPS_CreateEvent

 int IPS_CreateEvent (int $EventType) 

Parameters

EventType
Value Description
0 creates a "triggered" event
1 creates a "cyclical" event

Returns

ID of the newly created event

Description

The command creates an event object of the type EventType.

The function returns an ID that can help to uniquely identify the created event object. After the application the created object is still unconfigured and must be configured with the functions IPS_SetEventActive, IPS_SetEventScript and IPS_SetEventCyclic, IPS_SetEventTrigger.

Example

$eid = IPS_CreateEvent(0);        //triggered event
IPS_SetEventTrigger($eid, 1, 15754); //On change of variable with ID 15 754
IPS_SetParent($eid, $_IPS['SELF']); //Assigning the event
IPS_SetEventActive($eid, true);    //Activate the event

eid = IPS_CreateEvent(1);            //triggered event
IPS_SetEventCyclic($eid, 2, 1, 0, 3, 6);   //Every day, every 6 hours
IPS_SetEventCyclicDateBounds($eid,
mktime(0, 0, 0, 12, 1, date("Y")),
mktime(0, 0, 0, 12, 31,date("Y"))); //1.12 - 31.12 of every year 

IPS_SetEventCyclicTimeBounds($eid,
mktime(15, 0, 0),
mktime(23, 30, 0));               //15:00 till 23:30

IPS_SetParent($eid, $_IPS['SELF']);   //Assigning the event
IPS_SetEventActive($eid, true);        //Activate the event

// Required since IP-Symcon 6.0, if the event shall execute an automation (e.g. a PHP-Script)
IPS_SetEventAction($eid, '{7938A5A2-0981-5FE0-BE6C-8AA610D654EB}', []);
Any questions?