Documentation
IPS_GetObjectIDByName
int IPS_GetObjectIDByName (string $ObjectName, int $ParentID)
Parameters
ObjectName | The searched object name |
ParentID | ID of the object whose children object are searched |
Returns
ID of the found object, otherwise FALSE
Description
This function tries to detect the object with the name ObjectName whose parent object has the ID ParentID. It will return the ID of the first object whose name matches ObjectName. If no object is found, this function returns FALSE.
The parameter "ObjectName" must not be an empty string ("").
Caution: Names in IP Symcon can be chosen freely, so they are not unique. For this reason, the command can return the ID of another object.
This function generates a warning if the ident is not found. The @ operator can be used to supress this message. Please see the PHP manual for the exact functionality of this operator.
Example
$ObjectID = @IPS_GetObjectIDByName("Rain sensing", $ParentID);
if ($ObjectID === false)
echo "Object not found!";
else
echo "The Object ID is: ". $ObjectID;