ph_createtimedevent PowerHome formula function
Description
Create a timed event.
Syntax
ph_createtimedevent ( type, action, datetime )
Argument Description
type Integer representing the action type of the timed event. A 0 will create a macro timed event. A 1 will create a Send Keys timed event. A 2 will create a Formula timed event.
action String denoting the action associated with the timed event. If a macro type of timed event, use the macro id. If a Send Keys type of timed event, then a formula evaluating to a valid Send Keys string. If a Formula type of timed event, then any valid formula.
datetime Datetime value for when the timed event will execute.
Return value
Integer. Returns a 0 if the timed event was successfully created. Otherwise a value equivalent to the SQL error when attempting to insert into the timed event table.
Examples
The following examples demonstrate typical syntax/usage for this function. NOTE: the TimedEvent created will have a generic system id. If a labeled ID is desired see the "ph_createtimedevent1()" function.
CREATE AN EVENT 30 MINUTES FROM NOW
• ph_createtimedevent(2,"ph_insteon('DWN ROOM',ifastoff,0)",ph_relativedatetime(today(),30))

CREATE AN EVENT 45 SECONDS FROM NOW
• ph_createtimedevent(0,"LIGHT_OFF",datetime(today(),ph_relativetime(now(),45)))

TURN ON CHRISTMAS LIGHTS AT 7:30 AM CHRISTMAS MORNING
• ph_createtimedevent(0,"XMAS_LITES",2013-12-25 07:30:00)