Documentation
RegisterVariableFloat
Require: Symcon >= 4.0
mixed RegisterVariableFloat (string $Ident, string $Name, array $Presentation, int $Position)
Parameters
| Ident | Ident of the status variable |
| Name | Name of the status variable |
| Presentation | The configuration of the display as an array. A profile can be set via the Legacy profile. |
| Position | Position in the object tree and therefore also in the visualization. |
Returns
| Class | Type | Description |
|---|---|---|
| IPSModuleStrict | boolean | Returns whether the variable was created. The return value can be used, for example, to set an initial value. |
| IPSModule | integer | Variable ID of the created status variable. |
Description
This function creates a status variable of type Float with the ident Ident and the name Name. You can also specify which Presentation is to be used and at which Position the status variable is to be placed.
The structure of the presentations is described in more detail here.
Presentations can be used from version 8.0. In previous versions, profiles can be set as a string via the Presentation parameter.
This function can also be called if the variable already exists. In this case, only the presentation is updated if this is different. If the variable type is different, the variable is deleted without prompting and recreated with the correct variable type.
The variable ID can be determined via GetIDForIdent so that it does not have to be saved anywhere.
Example
// IPSModuleStrict
$created = $this->RegisterVariableFloat("Factor", "Zoom Factor", ["PRESENTATION"=> VARIABLE_PRESENTATION_SLIDER, 'SUFFIX' => ' %']);
if ($created) {
// Set initial value
$this->SetValue("Factor", 5.8);
}
// IPSModule
$variableID = $this->RegisterVariableFloat("Factor", "Zoom Factor", ["PRESENTATION"=> VARIABLE_PRESENTATION_SLIDER, 'SUFFIX' => ' %']);