ph_createtimedevent1 PowerHome formula function
Description
Create a timed event.
Syntax
ph_createtimedevent1 ( id, active, timing, freq, offset, offsetamt, reftime, type, action, boolean )
Argument |
Description |
id |
String. The ID you want to use for the Timed Event. Use a blank value to have PowerHome automatically create an ID. |
active |
Integer. Use 0 for the Timed Event to be set inactive. Use 1 for the Timed Event to be active. |
timing |
Integer. The Timing value for the Timed Event. Use 0 for Exact, 1 for Sunrise, 2 for Sunset, 3 for Dawn, 4 for Dusk. |
freq |
Long. The frequency the Timed Event will occur in minutes. Use 0 for a One Shot. 1440 is the equivalent to Daily. |
offset |
Integer. The type off offset to apply to the reftime. Use 0 for None, 1 for Absolute +, 2 for Absolute -, 3 for Random +, 4 for Random -, 5 for Random +/- |
offsetamt |
Integer. The offset amount in minutes to apply to the reftime depending upon the offset type. |
reftime |
DateTime. A datetime value for when the timed event will execute. |
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. |
boolean |
String representing the Boolean formula for the Timed Event. |
Return value
String. Returns the ID of the Timed Event that was created. Otherwise a string representing the error is returned.
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_createtimedevent1 ("ROOM OFF",1,1,0,2,20,TODAY(),2, "ph_insteon('CEILING_LIGHT',ifastoff,0)
• ph_createtimedevent1 ("MID CHAN OFF",1,1,0,1,15,TODAY(),2, "ph_insteon('MID CHANDELIER',ifastoff,0)+ph_insteon('MID CHANDELIER-R',ifastoff,0)","1")
/*Send turnoff 15 min after Sunrise*/
• ph_createtimedevent1 ("SOFA OFF",1,0,0,1,15,ph_relativedatetime(today(),30),2, "ph_insteon('SOFA',ifastoff,0)","1")
/*Send turnoff in 15 min */