« Back to Product

Documentation

IPS_SetEventScheduleAction

Require: Symcon >= 3.2

 bool IPS_SetEventScheduleAction (int $EventID, int $ScheduleActionID, string $Name, int $Color, string $ScriptContent) 

Parameters

EventID

ID of the event to be changed

ScheduleActionID

Unique ID for this schedule action. The ID is used for sorting. IDs only need to be unique for this event. Must be greater than 0.

Name

Name of the given schedule action

Color

Color value as HTML color code, e.g., 0x0000FF for blue

ScriptContent

PHP code without PHP tags (<? … ?>)

Returns

If the function succeeds, it returns TRUE, otherwise FALSE.

Description

The function sets the Name, the Color, and the executed Action to "Execute PHP Code" with the code ScriptContent for the schedule action with the ID ScheduleActionID of a schedule event with the ID EventID. The system variable $_IPS['ACTION'] is defined. System Variables can be used during the execution of the script.

If the argument Name is empty, the schedule action with the given ScheduleActionID is deleted. This is only possible if no switch point references that ScheduleActionID.

Warning

The ScheduleActionID must be greater than 0, otherwise an error is raised. In IPS_GetEvent, the ID 0 in LastActionID/NextActionID means "no action". Existing schedule actions with an ID less than or equal to 0 from older installations can still be deleted in order to recreate them with an ID of 1 or higher.

Example

//Creation of actions
IPS_SetEventScheduleAction($EventID, 1, "Warm", 0xFF0000, "FHT_SetTemperature(\$_IPS['TARGET'], 22.5);");
IPS_SetEventScheduleAction($EventID, 2, "Cold", 0x0000FF, "FHT_SetTemperature(\$_IPS['TARGET'], 17);");
IPS_SetEventScheduleAction($EventID, 3, "Eco", 0x00FF00, "FHT_SetTemperature(\$_IPS['TARGET'], 20);");

//Delete action with ID 3
IPS_SetEventScheduleAction($EventID, 3, "", 0, "");
Any questions?