« Back to Product

Documentation

IPS_CreateInstance

 int IPS_CreateInstance (string $ModuleID) 

Parameters

ModuleID

ModuleID of the object to create

Returns

ID of the newly created instance

Description

The function creates an unconfigured instance of the module ID ModuleID. Valid values for ModuleID can be determined by the function IPS_GetModuleList. The ModuleID is a GUID in the format {00000000-0000-0000-0000-000000000000}.

The function returns an ID which identifies the created instance. After using the function, the created object is still unconfigured and may need to be configured with the function IPS_SetProperty. The configuration needs to be applied with the function IPS_ApplyChanges. Otherwise, the new configuration will not affect the instance.

Example

//Create FS20 instance with the name "Standing lamp"
$InsID = IPS_CreateInstance("{48FCFDC1-11A5-4309-BB0B-A0DB8042A969}");
 
IPS_SetName($InsID, "Standing lamp"); // Name instance
IPS_SetParent($InsID, 12345); // Sort instance under the object with ID "12345"

//Configuration 
IPS_SetProperty($InsID, "HomeCode", "12345678"); //Change property "HomeCode"
IPS_ApplyChanges($InsID); //Apply changes -> The instance uses the changed HomeCode
Any questions?