« Back to Product

Documentation

IPS_CreateVariable

 int IPS_CreateVariable (int $VariableType) 

Parameters

VariableType
Value Constant Description
0 VARIABLETYPE_BOOLEAN Creates a variable of type Boolean
1 VARIABLETYPE_INTEGER Creates a variable of type Integer
2 VARIABLETYPE_FLOAT Creates a variable of type Float
3 VARIABLETYPE_STRING Creates a variable of type String

Returns

ID of the newly created variable

Description

This function creates a new IPS variable of the type VariableType.

It returns an ID that can be used to uniquely identify the new variable.

Example

// Create a float variable with the name "Room temperature living room"
$VarID_RoomTemperature = IPS_CreateVariable(VARIABLETYPE_FLOAT);
IPS_SetName($VarID_RoomTemperature, "Room temperature living room"); // Name the variable
IPS_SetParent($VarID_RoomTemperature, 12345); // Move the variable below the object with the ID "12345"
Any questions?