« 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 command creates an unconfigured instance of the module ID ModuleID. Legal values ​​for ModuleID can be determined by the function IPS_GetModuleList. The ModuleID is a 32Bit GUID in the format {00000000-0000-0000-0000-000000000000}.

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

Example

//FS20 Create Instance
$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?