# Module > Symcon documentation · English · generated on 2026-09-26 > Index: https://www.symcon.de/en/llms.txt Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/ _Requires Symcon >= 4.0_ ### Description A module basically consists of 2 files. The module.php and module.json. A configuration page (form.json) can optionally be provided. ### form.json Further information on the configuration page is available under [Configuration Forms](configuration-forms.md). ### locale.json Further information on the translation of the configuration page is available under [Localizations](../sdk-php.md). ### module.json This file contains frame information essential for identification and correct integration of the module. | Parameter | Data type | Description | | ------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | id | string | Unique [GUID](../../../concepts.md) for unique identification. [GUID Generator](../../sdk-tools.md) | | name | string | Module name. (A-Z, a-z, 0-9, spaces, underscores are allowed characters. However, spaces and underscores may not be at the beginning or the end. An empty name is also not valid.) | | type | integer | Module type (0: Core, 1: I/O, 2: Splitter, 3: Device, 4: Configurator, 5: Discovery) | | vendor | string | Manufacturer name and the name of the menu item under which the device can be found in "Add instance". If nothing is specified, the device is entered under "(Other)". | | aliases | array [string] | Additional device names/ variants | | url | string | URL to the documentation page of the module (Must start with http:// or https://. May alternatively be left "" (empty) | | parentRequirements | array [string] | Data flow [GUIDs](../../../concepts.md), whereby compatible parent instances are determined. The parent instance must have implemented at least one of these data flow GUIDs in order to be compatible | | childRequirements | array [string] | Data flow [GUIDs](../../../concepts.md), which determines compatible child instances. The child instance must have implemented at least one of these data flow GUIDs in order to be compatible | | implemented | array [string] | Supported data flow GUIDs must be correctly evaluated and supported in the respective ReceiveData/ ForwardData functions, provided they are listed here | | prefix | string | Prefix, which is assigned to the functions. Can only contain numbers and letters. | ```php { "id": "{E5AA629B-75BD-45C0-9BCB-845C102B0411}", "name": "ModulnameXYZ", "type": 3, "vendor": "", "aliases": [ "Name1SupportedDevice", "Name2SupportedDevice" ], "url": "https://www.symcon.de", "parentRequirements": [], "childRequirements": [], "implemented": [], "prefix": "ABC" } ``` ### module.php This is the actual class file, which contains the functions that process and forward data afterwards. > **Note:** The class name must be identical to the "name" parameter, which was defined in module.json. The only allowed difference are spaces. These must be removed from the class name within module.php. > **Warning:** Function names may only consist of the following characters: "a..z", "A..Z", "0..9". Furthermore, "$InstanceID" must not be used as a parameter name. Since IP-Symcon 8.1, the improved base class IPSModuleStrict is available. IPSModule remains supported but should no longer be used for new modules. The following table highlights the differences: | Feature | IPSModule | IPSModuleStrict | | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Type hints | Optional for public functions | Always required | | Errors for missing type hints in public functions | Only warnings | Treated as errors | | Support for outdated types | Integer/Boolean allowed | Use int/bool instead | | Return value of `RegisterVariable*` | Current variable ID as int | Boolean indicating whether the variable was created (e.g., to set an initial value) | | Write access to created variables | Always possible, also via SetValue from outside | Only via $this->SetValue (variables are protected as read-only) | | Data flow connections | Manual via ConnectParent/RequireParent/ForceParent | Automatic via compatibility and [GetCompatibleParents()](page://lJzvF8VHHoPHhcnn) | | Data flow encoding | UTF-8 (utf8_encode/utf8_decode), problematic with PHP 9.0 | HEX-encoded (bin2hex/hex2bin), easier to detect when encoding is needed | | Hook/WebHook | Workaround via [WebHookModule](https://github.com/symcon/SymconTest/blob/master/libs/WebHookModule.php) base class | Native support via [RegisterHook](module.md), [ProcessHookData](module.md) and [UnregisterHook](module.md) | | OAuth | Workaround via [WebOAuthModule](https://github.com/symcon/SymconTest/blob/master/libs/WebOAuthModule.php) base class | Native support via [RegisterOAuth](module.md), [ProcessOAuthData](module.md) and [UnregisterOAuth](module.md) | #### Template minimal ```php // class definition class ModulnameXYZ extends IPSModuleStrict { /** * The following functions are automatically available if the module has been inserted via the "Module Control". * The functions are, with the prefix set up by oneself, made available in PHP and JSON-RPC as follows: * * ABC_MyFirstOwnFunction($id); * */ public function MyFirstOwnFunction(): void { echo $this->InstanceID; } } ``` #### Template classic ```php // class definition class ModulnameXYZ extends IPSModuleStrict { // Overrides the internal IPS_Create($id) function public function Create(): void { // Don't delete this line parent::Create(); } // Overwrites the internal IPS_ApplyChanges($id) function public function ApplyChanges(): void { // Don't delete this line parent::ApplyChanges(); } /** * The following functions are automatically available if the module has been inserted via the "Module Control". * The functions are, with the prefix set up by oneself, made available in PHP and JSON-RPC as follows: * * ABC_MyFirstOwnFunction($id); * */ public function MyFirstOwnFunction(): void { // Self-created code } } ``` ## __construct Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/construct/ `void __construct(string $InstanceID)` _Requires Symcon >= 4.0_ Function that is called with every request to the module **Parameters** - `$InstanceID` (string): ID of this instance **Returns** (void): No Return ID of this instance **Example** ```php // Normally, this function does not need to be overwritten. ``` ## ApplyChanges Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/applychanges/ `void ApplyChanges()` _Requires Symcon >= 4.0_ Function which is executed when the configuration is applied **Returns** (void): No Return Is executed when "Apply" is pressed on the configuration page and immediately after the instance has been created. > **Note:** The ApplyChanges function is called by IP-Symcon. It must therefore be overwritten by the base class in order to add custom extensions **Example** ```php // IPSModuleStrict public function ApplyChanges(): void { // Do not delete this line parent::ApplyChanges(); // ConnectParent/RequireParent/ForceParent is not available - but can be replaced by the new function 'GetCompatibleParents()'. } // IPSModule public function ApplyChanges() { // Do not delete this line parent::ApplyChanges(); // If there is no parent instance, create a new own VirtualIO instance $this->RequireParent("{6179ED6A-FC31-413C-BB8E-1204150CF376}"); } ``` ## ConnectParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/connectparent/ `bool ConnectParent(string $ParentGUID)` _Requires Symcon >= 4.0_ Connects an instance to a parent instance **Parameters** - `$ParentGUID` (string): [GUID](../../../concepts.md) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. [GUID](../../../concepts.md) **Example** ```php // IPSModuleStrict ConnectParent/RequireParent/ForceParent is not available, but can be replaced by the new function "GetCompatibleParents()" // IPSModule public function Create() { // Never remove the line! parent::Create(); // Connect to an existing splitter or create a new one if necessary $this->ConnectParent("{46C969BF-3465-4E3E-B2A5-E404FB969735}"); } ``` ## Create Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/create/ `void Create()` _Requires Symcon >= 4.0_ Function that is called once when the instance is created **Returns** (void): No Return In contrast to [Construct](module.md), this function is called only once when creating the instance and starting IP-Symcon. Therefore, status variables and module properties which the module requires permanently should be created here. Frequently used functions: [RegisterPropertyString](module.md) [RegisterPropertyInteger](module.md) [RegisterPropertyFloat](module.md) [RegisterPropertyBoolean](module.md) > **Note:** The Create function is called by IP-Symcon. It must therefore be overwritten by the base class in order to add custom extensions **Example** ```php // IPSModuleStrict public function Create(): void { // Do not remove this line parent::Create(); // Module property creation $this->RegisterPropertyString("Username", "MaxMustermann"); $this->RegisterPropertyInteger("Number", 123); $this->RegisterPropertyFloat("Factor", 0.5); $this->RegisterPropertyBoolean("Open", true); } // IPSModule public function Create() { // Example is identical. Please note the changed function signature. } ``` ## Destroy Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/destroy/ `void Destroy()` _Requires Symcon >= 4.1_ Function that is called when the instance is deleted or the module is updated **Returns** (void): No Return This function is called when deleting the instance during operation and when updating via "Module Control". The function is not called when exiting IP-Symcon. > **Note:** The Destroy function is called by IP-Symcon. It must therefore be overwritten by the base class in order to add individual extensions. **Example** ```php // IPSModuleStrict public function Destroy(): void { // Do not remove this line parent::Destroy(); } // IPSModule public function Destroy() { // Example is identical. Please note the changed function signature. } ``` ## DisableAction Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/disableaction/ `bool DisableAction(string $Ident)` _Requires Symcon >= 4.0_ **Parameters** - `$Ident` (string): Ident of the variable **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Ident of the variable **Example** ```php // Deactivates the default action of the status variable $this->DisableAction("Status"); ``` ## EnableAction Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/enableaction/ `bool EnableAction(string $Ident)` _Requires Symcon >= 4.0_ **Parameters** - `$Ident` (string): Ident of the variable **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Ident of the variable **Example** ```php // Activates the default action of the status variable $this->EnableAction("Status"); ``` ## ForceParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/forceparent/ `bool ForceParent(string $ModuleID)` _Requires Symcon >= 4.0_ Connects an instance to a parent instance **Parameters** - `$ModuleID` (string): [GUID](../../../concepts.md) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. [GUID](../../../concepts.md) **Example** ```php // IPSModuleStrict ConnectParent/RequireParent/ForceParent is not available, but can be replaced by the new function "GetCompatibleParents()" // IPSModule public function ApplyChanges() { // Never remove the line! parent::ApplyChanges(); // Create different I/O instances depending on the configuration switch($this->ReadPropertyInteger("GatewayMode")) { case 0: //Create ClientSocket in mode 0 $this->ForceParent("{3CFF0FD9-E306-41DB-9B5A-9D06D38576C3}"); break; case 1: //Create SerialPort in mode 1 $this->ForceParent("{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}"); break; } } ``` ## ForwardData Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/forwarddata/ `string ForwardData(string $JSONString)` _Requires Symcon >= 4.0_ Function which is called when receiving data from a child instance (e.g. device) **Parameters** - `$JSONString` (string): Data packet in JSON format **Returns** (string): Result of the function, which is returned to the calling child instance Data packet in JSON format **Example** ```php // IPSModuleStrict public function ForwardData(string $JSONString): string { // Example within a gateway/splitter instance // Received data from the device instance $data = json_decode($JSONString); IPS_LogMessage("ForwardData", utf8_decode($data->Buffer)); // The buffer would normally be processed here // e.g., check CRC, partition into individual parts // Forward to the I/O instance $resultat = $this->SendDataToParent(json_encode(Array("DataID" => "{79827379-F36E-4ADA-8A95-5F8D1DC92FA9}", "Buffer" => $data->Buffer))); // Processing and passing on return $resultat; } // IPSModule public function ForwardData($JSONString) { // Example is identical. Please note the changed function signature. } ``` ## GetBuffer Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getbuffer/ `string GetBuffer(string $Name)` _Requires Symcon >= 4.1_ Returns the content of a buffer **Parameters** - `$Name` (string): The name of the buffer **Returns** (string): The content of the buffer The name of the buffer **Example** ```php // Returns the content of the "Databuffer" buffer $Bufferdata = $this->GetBuffer("DataBuffer"); ``` ## GetBufferList Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getbufferlist/ `array GetBufferList()` _Requires Symcon >= 5.0_ Returns an array with the names of all buffers **Returns** (array): List of names of all buffers This function returns an array with the names of all buffers. **Example** ```php // Returns the array of buffer names $BufferList = $this->GetBufferList(); ``` ## GetCompatibleParents Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getcompatibleparents/ `string GetCompatibleParents()` _Requires Symcon >= 8.2_ Overwritable function that describes the compatible physically higher-level instances **Returns** (string): Required connection type and description of compatible instances The function returns a JSON-encoded object that describes compatible physical parent instances. The management console uses this information to suggest the appropriate parent instances when creating or adapting the instance. If the function is not implemented, all modules that are compatible according to the data flow are returned. For the module type Splitter, Discovery and Configurators, a new instance or an instance without connections is required (type = require); for the module type Device, existing instances with other connections are also suggested (type = connect). All other module types do not require any further connection. In most cases, this heuristic is sufficient. However, if it is not sufficient, the function can be overwritten. ### Parameter | Name | Description | | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type | If "require", only newly created instances and instances without other physically child instances are offered. If "connect" is selected, newly created instances and all existing compatible instances are suggested. | | moduleIDs | A list of moduleIDs of compatible parent instances. If moduleIDs is used, no extended parameters can be used. Either moduleIDs or modules must be set, but not both. | | modules | A description of possible compatible parent instances. For the possible parameters, see modules. Either moduleIDs or modules must be set, but not both. | #### modules | Name | Description | | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | moduleID | The moduleID of instances that are compatible | | configuration (optional) | (**default**: {}) An object that describes the required configuration of the instance. Existing instances that do not have the specified configuration are not displayed as compatible. If a new instance is created, this configuration is enforced and cannot be changed by the user. | | initial (optional) | (**default**: {}) An object that contains suggested configuration parameters. If a new instance is created, these parameters are initially filled in, but can be adjusted by the user. The object has no effect on existing instances. | | formOverride (optional) | (**default**: {}) An object that describes adjustments to the configuration form of the new instance, which are applied in a similar way to [UpdateFormField](module.md). The keys of the object are the names of the configuration elements. The values are in turn objects that contain the names of the fields as keys and the updated parameter as values. The object has no effect on existing instances. | **Example** ```php // Require a new instance, a serial port public function GetCompatibleParents() { return '{"type": "require", "moduleIDs": ["{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}"]}'; } // Require an MQTT Client with a specific Client ID // When creating a new gateway, the initial value for the keep alive interval is 10 seconds, different from the usual default value. However, it can be adjusted public function GetCompatibleParents() { return '{"type": "connect", "modules": [{ "moduleID": "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}", "configuration": { "ClientID": "b10c75459d64cafb5d78" }, "initial": { "KeepAliveInterval": 10 } }]}'; } // Require a new instance, a serial port with Baud Rate 2400 or 9600 public function GetCompatibleParents() { return '{"type": "require", "modules": [{ "moduleID": "{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}", "formOverride": { "Baudrate": { "options": [ { "value": "2400", "caption": "2400" }, { "value": "9600", "caption": "9600" } ] } } }]}'; } ``` ## GetConfigurationForm Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getconfigurationform/ `string GetConfigurationForm()` _Requires Symcon >= 4.1_ Extendable function that supplies the content of the configuration page **Returns** (string): Content of the configuration page The content can be overwritten in order to transfer a self-created configuration page. This way, content can be generated dynamically. In this case, the "form.json" on the file system is completely ignored. > **Note:** If this function is not defined in a module, the content of form.json is passed on by default. **Example** ```php // IPSModuleStrict public function GetConfigurationForm() { return '{ "actions": [ { "type": "Label", "label": "The current time is '.date("d.m.y H:i").'" } ] }'; } // IPSModule public function GetConfigurationForm() { // xxx } ``` ## GetConfigurationForParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getconfigurationforparent/ `string GetConfigurationForParent()` _Requires Symcon >= 4.2_ Extendable function which partially or completely sets the configuration of the parent instance **Returns** (string): Content of the configuration of the parent instance The configuration string is transferred to the parent instance. The instance reads the string and sets the entered values. Values read in via this function can no longer be changed via the configuration page. > **Note:** If this function is not defined in its own module, nothing is changed by default and the parent instance remains freely configurable. **Example** ```php // IPSModuleStrict public function GetConfigurationForParent() { // Parent instance is a "SerialPort" return "{\"BaudRate\": \"57600\", \"StopBits\": \"1\", \"DataBits\": \"8\", \"Parity\": \"None\"}"; } // IPSModule public function GetConfigurationForParent() { // xxxx } ``` ## GetIDForIdent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getidforident/ `mixed GetIDForIdent(string $Ident)` _Requires Symcon >= 4.0_ Searches for the object ID for an object via the object identifier **Parameters** - `$Ident` (string): Ident of the object to be searched for. **Returns** (mixed): ID of the found object, otherwise FALSE Ident of the object to be searched for. **Example** ```php // Output the path of the status variable with the Ident "Status" echo IPS_GetLocation($this->GetIDForIdent("Status")); ``` ## GetMessageList Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getmessagelist/ `array GetMessageList()` _Requires Symcon >= 5.0_ Returns an array of all registered messages **Returns** (array): Array of all active messages This function returns an array with all active messages that were registered via [RegisterMessage](module.md). A list of message IDs is available here: [Messages](../sdk-php.md) > **Note:** To cancel a registration, [UnregisterMessage](module.md) can be used. **Example** ```php // Returns an array of the active registered messages print_r($this->GetMessageList()); // Sample output: array(1) { [12345]=> //ID of the Instance array(1) { [0]=> int(10505) //MessageID => IM_CHANGESTATUS } } ``` ## GetReferenceList Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getreferencelist/ `array GetReferenceList()` _Requires Symcon >= 5.1_ Returns an array with the IDs of all references **Returns** (array): Array with integer values of the IDs of all references This function returns an array with the IDs of all references. **Example** ```php $ReferenceList = $this->GetReferenceList(); ``` ## GetStatus Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getstatus/ `int GetStatus()` _Requires Symcon >= 5.1_ Returns the current status of the instance **Returns** (int): Current status This function returns the current status of the instance. _Table: Instance status_ | Value | #status | | ----- | ------------------------ | | 101 | Instance is creating | | 102 | Instance is active | | 103 | Instance is deleting | | 104 | Instance is inactive | | 105 | Instance was not created | | 106 | Instance is in standby | | >=200 | Instance is faulty | For more information on status codes, see [Messages](../sdk-php.md). **Example** ```php // Queries the current status of the instance $currentStatus = $this->GetStatus(); ``` ## GetTimerInterval Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/gettimerinterval/ `int GetTimerInterval(string $Name)` _Requires Symcon >= 5.2_ Queries the interval of a timer **Parameters** - `$Name` (string): The name of the timer whose interval is to be queried. **Returns** (int): Currently set interval in milliseconds The name of the timer whose interval is to be queried. **Example** ```php // Queries the interval of the "Update" timer echo $this->GetTimerInterval("Update"); ``` ## GetValue Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getvalue/ `mixed GetValue(string $Ident)` _Requires Symcon >= 5.0_ Returns the value of a status variable **Parameters** - `$Ident` (string): Ident of the status variable **Returns** (mixed): The content of the status variable Ident of the status variable **Example** ```php // Returns the value of the status variable "Statusvariable1" $StatusvariableValue = $this->GetValue("Statusvariable1"); ``` ## GetVisualizationTile Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/getvisualizationtile/ `string GetVisualizationTile()` _Requires Symcon >= 7.1_ Returns the individual display via HTML SDK **Returns** (string): Initial display of a presentation via HTML SDK If the [HTML-SDK](../sdk-php.md) is to be used, this function must be overwritten in order to return the HTML content. > **Note:** For easier processing, it is usually worth defining the constant part of the display in an HTML file instead of writing it out completely in this function **Example** ```r // IPSModuleStrict public function GetVisualizationTile(): string { // Directly return the contents of the module.html in the same directory return file_get_contents('./module.html'); } // IPSModule public function GetVisualizationTile() { // xxxx } ``` ## HasActiveParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/hasactiveparent/ `bool HasActiveParent()` _Requires Symcon >= 5.1_ Checks whether all physical parent instances are active **Returns** (bool): __TRUE__, if all physical parent instances are active, otherwise __FALSE__ This function checks whether all physical parent instances are active. If at least one instance in the chain is not active, the function returns __FALSE__. If all instances are active, the function returns __TRUE__. > **Note:** If there is no parent, the function also returns __FALSE__. **Example** ```php // Abort with an error message if the splitter or I/O are not ready if (!$this->HasActiveParent()) { echo "error: Parent instances are not active "; return; } // ... ``` ## LogMessage Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/logmessage/ `bool LogMessage(string $Message, int $Type)` _Requires Symcon >= 5.0_ Sends a message with type coding **Parameters** - `$Message` (string): Content of the message - `$Type` (int) | Type | Value | Description | | ---------- | ----- | ------------------ | | KL_DEBUG | 10206 | A debug message | | KL_ERROR | 10205 | An error message | | KL_MESSAGE | 10201 | A standard message | | KL_NOTIFY | 10203 | A notification | | KL_WARNING | 10204 | A warning message | **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. | Type | Value | Description | | ---------- | ----- | ------------------ | | KL_DEBUG | 10206 | A debug message | | KL_ERROR | 10205 | An error message | | KL_MESSAGE | 10201 | A standard message | | KL_NOTIFY | 10203 | A notification | | KL_WARNING | 10204 | A warning message | **Example** ```php // Send a warning message in the message window $this->LogMessage("This is a warning", KL_WARNING); ``` ## MaintainAction Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/maintainaction/ `bool MaintainAction(string $Ident, bool $ActivateAction)` _Requires Symcon >= 4.0_ Activates/deactivates the default action depending on the parameter **Parameters** - `$Ident` (string): Ident of the variable - `$ActivateAction` (bool): Enable if __True__, Disable if __False__ **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Enable if __True__, Disable if __False__ **Example** ```php // We only have an action if the device type == 5 $this->MaintainAction("SpecialData", $this->ReadPropertyInteger("DeviceType") == 5); ``` ## MaintainVariable Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/maintainvariable/ `mixed MaintainVariable(string $Ident, string $Name, int $Type, string $ProfileOrPresentation, int $Position, bool $Retain)` _Requires Symcon >= 4.0_ Creates/deletes the status variable depending on the parameter **Parameters** - `$Ident` (string): Ident of the status variable - `$Name` (string): Name of the status variable - `$Type` (int): Type of status variable - `$ProfileOrPresentation` (string): Name of the variable profile or configuration of the [Presentation](../sdk-php.md) to be used - `$Position` (int): Position in the object tree and therefore also in the WebFront - `$Retain` (bool): Register if __True__, Unregister if __False__ **Returns** (mixed): | 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. | Register if __True__, Unregister if __False__ **Example** ```php // We only have this status variable if the device type is == 5 // IPSModuleStrict $created = $this->MaintainVariable("Status", "Status of Device", 3, "Myvariablesprofileforstatus", 0, $this->ReadPropertyInteger("DeviceType") == 5); if ($created) { // Initial value should be true $this-SetValue("Status", true); } // IPSModule $variableID = $this->MaintainVariable("Status", "Status of Device", 3, "Myvariablesprofileforstatus", 0, $this->ReadPropertyInteger("DeviceType") == 5); ``` ## MessageSink Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/messagesink/ `void MessageSink(int $TimeStamp, int $SenderID, int $MessageID, array $Data)` _Requires Symcon >= 4.1_ Extendable function which processes registered messages **Parameters** - `$TimeStamp` (int): Continuous counter timestamp - `$SenderID` (int): Sender ID - `$MessageID` (int): ID of the message - `$Data` (array): Data of the message **Returns** (void): No Return Data of the message **Example** ```php // IPSModuleStrict public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $Data) { IPS_LogMessage("MessageSink", "Message from SenderID ".$SenderID." with Message ".$Message."\r\n Data: ".print_r($Data, true)); } // IPSModule public function MessageSink($TimeStamp, $SenderID, $Message, $Data) { // xxx } ``` ## Migrate Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/migrate/ `string Migrate(string $JSONData)` _Requires Symcon >= 7.0_ Function that is called once after the creation of the instance **Parameters** - `$JSONData` (string): Persistenz (Konfiguration, Attribute) der Instanz **Returns** (string): JSON encoded object with the new configuration/attributes. Empty string unless changes are needed. Persistenz (Konfiguration, Attribute) der Instanz **Example** ```php // IPSModuleStrict public function Migrate(string $JSONData): string { // Don't remove this line parent::Migrate($JSONData); // Example data for JSONData /* { "attributes": { "MyAttribute": "MyValue" }, "configuration": { "MyConfiguration": "MyValue" } } */ // Migrate Configuration/Attributes $j = json_decode($JSONString); $j->attributes->NewAttribut = $j->attributes->MyAttribute; $j->configuration->NewConfiguration = $j->configuration->MyConfiguration; return json_encode($j); } // IPSModule public function Migrate($JSONData) { // xxx } ``` ## ProcessHookData Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/processhookdata/ `void ProcessHookData()` _Requires Symcon >= 4.0_ Function that is called when the previously registered webhook is called **Returns** (void): No return If the WebHook registered by the function [RegisterHook](module.md) in the [WebHook Control](../../../modules/webhook-control.md) is called from outside, this function is executed. The output of this function (e.g. through echo) is returned to the caller. The header of the response can also be adapted using corresponding PHP functions. **Example** ```php // IPSModuleStrict protected function ProcessHookData(): void { // Received data $data = json_decode(file_get_contents('php://input'), true); $this->LogMessage('Remote Method', utf8_decode($data['method']), KL_MESSAGE); if ($data['method'] == 'get_version') { header('Content-Type: application/json'); echo json_encode([ 'result' => IPS_GetKernelVersion(), 'jsonrpc' => '2.0', 'id' => $request['id'] ]); } } // IPSModule protected function ProcessHookData($JSONString) { // Example is identical. Please note the changed function signature. } ``` ## ProcessOAuthData Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/processoauthdata/ `void ProcessOAuthData()` _Requires Symcon >= 4.1_ Function that is called when the OAuth process is completed **Returns** (void): No return If the OAuth handler registered by the function [RegisterOAuth](module.md) is called, this function is executed. The received OAuth credentials can be read, for example, via the corresponding PHP input streams. **Example** ```php // IPSModuleStrict protected function ProcessOAuthData(): void { // OAuth credentials from the request $token = file_get_contents('php://input'); $this->LogMessage('OAuth token received', KL_MESSAGE); // Save token $this->WriteAttributeString('OAuthToken', $token); } // IPSModule protected function ProcessOAuthData($Token) { // Example is identical. Please note the changed function signature. } ``` ## ReadAttributeBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readattributeboolean/ `bool ReadAttributeBoolean(string $Name)` _Requires Symcon >= 5.1_ Reads an attribute of type boolean **Parameters** - `$Name` (string): Name of the attribute **Returns** (bool): The value of the attribute Name of the attribute **Example** ```php $this->ReadAttributeBoolean("CurrentState"); ``` ## ReadAttributeFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readattributefloat/ `float ReadAttributeFloat(string $Name)` _Requires Symcon >= 5.1_ Reads an attribute of type float **Parameters** - `$Name` (string): Name of the attribute **Returns** (float): The value of the attribute Name of the attribute **Example** ```php $this->ReadAttributeFloat("Median"); ``` ## ReadAttributeInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readattributeinteger/ `int ReadAttributeInteger(string $Name)` _Requires Symcon >= 5.1_ Reads an attribute of type integer **Parameters** - `$Name` (string): Name of the attribute **Returns** (int): The value of the attribute Name of the attribute **Example** ```php $this->ReadAttributeInteger("SequenceCounter") ``` ## ReadAttributeString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readattributestring/ `string ReadAttributeString(string $Name)` _Requires Symcon >= 5.1_ Reads an attribute of type string **Parameters** - `$Name` (string): Name of the attribute **Returns** (string): The value of the attribute Name of the attribute **Example** ```php $this->ReadAttributeString("Token"); ``` ## ReadPropertyBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readpropertyboolean/ `bool ReadPropertyBoolean(string $Name)` _Requires Symcon >= 4.0_ Reads a property of type boolean **Parameters** - `$Name` (string): Name of the property **Returns** (bool): The value of the property Name of the property **Example** ```php $this->ReadPropertyBoolean("EmulateStatus"); ``` ## ReadPropertyFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readpropertyfloat/ `float ReadPropertyFloat(string $Name)` _Requires Symcon >= 4.0_ Reads a property of type float **Parameters** - `$Name` (string): Name of the property **Returns** (float): The value of the property Name of the property **Example** ```php $this->ReadPropertyFloat("Factor"); ``` ## ReadPropertyInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readpropertyinteger/ `int ReadPropertyInteger(string $Name)` _Requires Symcon >= 4.0_ Reads a property of type integer **Parameters** - `$Name` (string): Name of the property **Returns** (int): The value of the property Name of the property **Example** ```php $this->ReadPropertyInteger("GatewayMode"); ``` ## ReadPropertyString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/readpropertystring/ `string ReadPropertyString(string $Name)` _Requires Symcon >= 4.0_ Reads a property of type string **Parameters** - `$Name` (string): Name of the property **Returns** (string): The value of the property Name of the property **Example** ```php $this->ReadPropertyString("Username"); ``` ## ReceiveData Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/receivedata/ `string ReceiveData(string $JSONString)` _Requires Symcon >= 4.0_ Function that is called when data is received from a parent entity (e.g. I/O, splitter) **Parameters** - `$JSONString` (string): Data package in JSON format **Returns** (string): Optional response to the parent instance Data package in JSON format **Example** ```php // IPSModuleStrict public function ReceiveData(string $JSONString): string { // Example within a gateway/splitter instance // Received data from I/O $data = json_decode($JSONString); IPS_LogMessage("ReceiveData", utf8_decode($data->Buffer)); // This is where the data is processed // Forwarding to all device-/device-instances $results = $this->SendDataToChildren(json_encode(Array("DataID" => "{66164EB8-3439-4599-B937-A365D7A68567}", "Buffer" => $data->Buffer))); // If a child instance delivers a result, this can be used. foreach($results as $result) { IPS_LogMessage("IOSplitter RECV-RES", $result); } } // Example within a device-/device-instance public function ReceiveData(string $JSONString): string { // Received data from the gateway/splitter $data = json_decode($JSONString); IPS_LogMessage("ReceiveData", utf8_decode($data->Buffer)); // Data processing and writing of the values in the status variables SetValue($this->GetIDForIdent("Value"), $data->Buffer); // Send result back to the gateway/splitter return "OK from " . $this->InstanceID; } // IPSModule public function ReceiveData($JSONString) { // xxxx } ``` ## RegisterAttributeBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerattributeboolean/ `bool RegisterAttributeBoolean(string $Name, bool $DefaultValue)` _Requires Symcon >= 5.1_ Creates an attribute of type boolean **Parameters** - `$Name` (string): Name of the attribute - `$DefaultValue` (bool): Default value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the attribute **Example** ```php public function Create() { // Don't delete or change this line. parent::Create(); $this->RegisterAttributeBoolean("CurrentState", true); } ``` ## RegisterAttributeFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerattributefloat/ `bool RegisterAttributeFloat(string $Name, float $DefaultValue)` _Requires Symcon >= 5.1_ Creates an attribute of type float **Parameters** - `$Name` (string): Name of the attribute - `$DefaultValue` (float): Default value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the attribute **Example** ```php public function Create() { // Don't delete or change this line. parent::Create(); $this->RegisterAttributeFloat("Median", 0.5); } ``` ## RegisterAttributeInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerattributeinteger/ `bool RegisterAttributeInteger(string $Name, int $DefaultValue)` _Requires Symcon >= 5.1_ Creates an attribute of type integer **Parameters** - `$Name` (string): Name of the attribute - `$DefaultValue` (int): Default value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the attribute **Example** ```php public function Create() { // Don't delete or change this line. parent::Create(); $this->RegisterAttributeInteger("SequenceCounter", 0); } ``` ## RegisterAttributeString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerattributestring/ `bool RegisterAttributeString(string $Name, string $DefaultValue)` _Requires Symcon >= 5.1_ Creates an attribute of type string **Parameters** - `$Name` (string): Name of the attribute - `$DefaultValue` (string): Default value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the attribute **Example** ```php public function Create() { // Don't delete or change this line. parent::Create(); $this->RegisterAttributeString("Token", ""); } ``` ## RegisterHook Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerhook/ `bool RegisterHook(string $Address)` _Requires Symcon >= 8.1_ Registers a WebHook with the specified address **Parameters** - `$Address` (string): Address of the hook **Returns** (bool): If the command could be executed successfully, the result is __TRUE__, otherwise __FALSE__. Address of the hook **Example** ```php // IPSModuleStrict public function Create(): void { // Do not remove this line parent::Create(); $this->RegisterHook('my-module'); } // IPSModule // This function can only be used natively for IPSModuleStrict // Using the base class WebHookModule enables a comparable use in IPSModule ``` ## RegisterMessage Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registermessage/ `bool RegisterMessage(int $SenderID, int $MessageID)` _Requires Symcon >= 4.1_ Registers a message for a SenderID **Parameters** - `$SenderID` (int): ID of the Sender - `$MessageID` (int): ID of the message **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. ID of the message **Example** ```php $this->RegisterMessage(12345 /* InstanzID */, 10505 /* IM_CHANGESTATUS */); ``` ## RegisterOAuth Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registeroauth/ `bool RegisterOAuth(string $Identifier)` _Requires Symcon >= 8.1_ Registers an OAuth handler with the specified identifier **Parameters** - `$Identifier` (string): Identifier of the OAuth handler **Returns** (bool): If the command could be executed successfully, the result is __TRUE__, otherwise __FALSE__. Identifier of the OAuth handler **Example** ```php // IPSModuleStrict public function Create(): void { // Do not remove this line parent::Create(); $this->RegisterOAuth('my-module'); } // IPSModule // This function can only be used natively for IPSModuleStrict // Using the base class WebOAuthModule enables a comparable use in IPSModule ``` ## RegisterOnceTimer Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registeroncetimer/ `bool RegisterOnceTimer(string $Name, string $ScriptContent)` _Requires Symcon >= 5.5_ Creates a one-time timer **Parameters** - `$Name` (string): Name of the timer - `$ScriptContent` (string): PHP script without PHP tags (<?php ... ) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. PHP script without PHP tags (<?php ... ) **Example** ```php // Creates a timer called "Update". $this->RegisterOnceTimer("Update", "echo 'Hallo World';"); ``` ## RegisterPropertyBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerpropertyboolean/ `bool RegisterPropertyBoolean(string $Name, bool $DefaultValue)` _Requires Symcon >= 4.0_ Creates a property of type Boolean **Parameters** - `$Name` (string): Name of the property - `$DefaultValue` (bool): Default value of the property **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the property **Example** ```php public function Create(): void { // Don't delete or change this line. parent::Create(); $this->RegisterPropertyBoolean("EmulateStatus", true); } ``` ## RegisterPropertyFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerpropertyfloat/ `bool RegisterPropertyFloat(string $Name, float $DefaultValue)` _Requires Symcon >= 4.0_ Creates a property of type float **Parameters** - `$Name` (string): Name of the property - `$DefaultValue` (float): Default value of the property **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the property **Example** ```php public function Create(): void { //Don't delete or change this line. parent::Create(); $this->RegisterPropertyFloat("Factor", 0.5); } ``` ## RegisterPropertyInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerpropertyinteger/ `bool RegisterPropertyInteger(string $Name, int $DefaultValue)` _Requires Symcon >= 4.0_ Creates a property of type Integer **Parameters** - `$Name` (string): Name of the property - `$DefaultValue` (int): Default value of the property **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the property **Example** ```php public function Create(): void { // Don't delete or change this line. parent::Create(); $this->RegisterPropertyInteger("GatewayMode", 0); } ``` ## RegisterPropertyString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerpropertystring/ `bool RegisterPropertyString(string $Name, string $DefaultValue)` _Requires Symcon >= 4.0_ Creates a property of type String **Parameters** - `$Name` (string): Name of the property - `$DefaultValue` (string): Default value of the property **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Default value of the property **Example** ```php public function Create(): void { // Don't delete or change this line. parent::Create(); $this->RegisterPropertyString("Username", "MaxMustermann"); } ``` ## RegisterReference Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerreference/ `bool RegisterReference(int $ID)` _Requires Symcon >= 5.1_ Registers an ID as referenced **Parameters** - `$ID` (int): ID of the object **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. ID of the object **Example** ```php $this->RegisterReference(10505 /* ObjectID */); ``` ## RegisterScript Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registerscript/ `mixed RegisterScript(string $Ident, string $Name, string $Contents, int $Position)` _Requires Symcon >= 4.0_ Creates a script if it does not already exist **Parameters** - `$Ident` (string): Ident of the script - `$Name` (string): Name of the script - `$Contents` (string) Content to be entered in the script.
__Default__ == "<?php //Autogenerated script" - `$Position` (int): Position in the object tree and thus also in the visualization.
__Default__ == 0 **Returns** (mixed): | Class | Type | Description | | --------------- | ------- | --------------------------------------------------------------------------------------------------------------------- | | IPSModule | integer | Returns the object ID of the created or existing script. | | IPSModuleStrict | boolean | Returns whether the script was created. The return value can be used, for example, to perform initial configurations. | Position in the object tree and thus also in the visualization.
__Default__ == 0 **Example** ```php // IPSModuleStrict $created = $this->RegisterScript("TestScript", "My TestScript"); if ($created) { // Do things, after initially creating the script } // IPSModule $scriptID = $this->RegisterScript("TestScript", "My TestScript"); ``` ## RegisterTimer Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registertimer/ `bool RegisterTimer(string $Name, int $Interval, string $ScriptContent)` _Requires Symcon >= 4.0_ Creates a timer **Parameters** - `$Name` (string): Name of the timer - `$Interval` (int): Interval in milliseconds with which the timer should be created. 0 = never - `$ScriptContent` (string): PHP script without PHP tags (<?php ... ) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. PHP script without PHP tags (<?php ... ) **Example** ```php // Creates a timer named "Update" with an interval of 5 seconds. $this->RegisterTimer("Update", 5000, "echo 'Hello World';"); ``` ## RegisterVariableBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registervariableboolean/ `mixed RegisterVariableBoolean(string $Ident, string $Name, array $Presentation, int $Position)` _Requires Symcon >= 4.0_ Creates a status variable of type Boolean **Parameters** - `$Ident` (string): Ident of the status variable - `$Name` (string): Name of the status variable - `$Presentation` (array): The configuration of the presentation as an array. A profile can be set via the [Legacy profile](../sdk-php.md).
__Default__ == "" - `$Position` (int): Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Returns** (mixed): | 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. | Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Example** ```php // IPSModuleStrict $created = $this->RegisterVariableBoolean("Switch", "Light Switch", ["PRESENTATION" => VARIABLE_PRESENTATION_SWITCH]); if ($created) { // Set initial value $this->SetValue("Switch", true); } // IPSModule $variableID = $this->RegisterVariableBoolean("Switch", "Light Switch", ["PRESENTATION" => VARIABLE_PRESENTATION_SWITCH]); ``` ## RegisterVariableFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registervariablefloat/ `mixed RegisterVariableFloat(string $Ident, string $Name, array $Presentation, int $Position)` _Requires Symcon >= 4.0_ Creates a status variable of type Float **Parameters** - `$Ident` (string): Ident of the status variable - `$Name` (string): Name of the status variable - `$Presentation` (array): The configuration of the display as an array. A profile can be set via the [Legacy profile](../sdk-php.md).
__Default__ == "" - `$Position` (int): Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Returns** (mixed): | 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. | Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Example** ```php // 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' => ' %']); ``` ## RegisterVariableInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registervariableinteger/ `mixed RegisterVariableInteger(string $Ident, string $Name, array $Presentation, int $Position)` _Requires Symcon >= 4.0_ Creates a status variable of type integer **Parameters** - `$Ident` (string): Ident of the status variable - `$Name` (string): Name of the status variable - `$Presentation` (array): The configuration of the display as an array. A profile can be set via the [Legacy profile](../sdk-php.md).
__Default__ == "" - `$Position` (int): Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Returns** (mixed): | 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. | Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Example** ```php // IPSModuleStrict $created = $this->RegisterVariableInteger("Brightness", "Lamp Brightness", ["PRESENTATION"=> VARIABLE_PRESENTATION_SLIDER, 'SUFFIX' => ' lx']); if ($created) { // Set initial value $this->SetValue("Brightness", 50); } // IPSModule $variablenID = $this->RegisterVariableInteger("Brightness", "Lamp Brightness", ["PRESENTATION"=> VARIABLE_PRESENTATION_SLIDER, 'SUFFIX' => ' lx']); ``` ## RegisterVariableString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/registervariablestring/ `mixed RegisterVariableString(string $Ident, string $Name, array $Presentation, int $Position)` _Requires Symcon >= 4.0_ Creates a status variable of type String **Parameters** - `$Ident` (string): Ident of the status variable - `$Name` (string): Name of the status variable - `$Presentation` (array): The configuration of the display as an array. A profile can be set via the [Legacy profile](../sdk-php.md).
__Default__ == "" - `$Position` (int): Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Returns** (mixed): | 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. | Position in the object tree and therefore also in the visualization.
__Default__ == 0 **Example** ```php // IPSModuleStrict $created = $this->RegisterVariableString("Name", "My Name", ["PRESENTATION"=> VARIABLE_PRESENTATION_VALUE_INPUT]); if ($created) { // Set initial value $this->SetValue("Name", "Peter"); } // IPSModule $variablenID = $this->RegisterVariableString("Name", "My Name", ["PRESENTATION"=> VARIABLE_PRESENTATION_VALUE_INPUT]); ``` ## ReloadForm Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/reloadform/ `bool ReloadForm()` _Requires Symcon >= 5.2_ Reload the instance configuration **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. This function reloads the instance configuration form in each open instance configuration. Current entries will get lost. **Example** ```php // Reload the form $this->ReloadForm(); ``` ## RequestAction Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/requestaction/ `void RequestAction(string $Ident, mixed $Value)` Function that is called when the visualization requests a value change. **Parameters** - `$Ident` (string): Ident of the variable - `$Value` (mixed): The value to be set **Returns** (void): No Return The value to be set **Example** ```php // IPSModuleStrict public function RequestAction(string $Ident, mixed $Value): void { switch($Ident) { case "TestVariable": // An action, e.g. switching, would normally be carried out here // Outputs via 'echo' are returned to the visualization // Write new value to the status variable SetValue($this->GetIDForIdent($Ident), $Value); break; default: throw new Exception("Invalid Ident"); } } // IPSModule public function RequestAction($Ident, $Value) { // xxxxx } ``` ## RequireParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/requireparent/ `bool RequireParent(string $ParentGUID)` _Requires Symcon >= 4.0_ Connects an instance to a parent instance **Parameters** - `$ParentGUID` (string): [GUID](https://www.symcon.de/en/service/documentation/basics/instances#GUID) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. [GUID](https://www.symcon.de/en/service/documentation/basics/instances#GUID) **Example** ```php // IPSModuleStrict ConnectParent/RequireParent/ForceParent is not available, but can be replaced by the new function “GetCompatibleParents()”. // IPSModule public function Create() { // Never remove the line! parent::Create(); // Connect to the newly created splitter if there is no connection yet $this->RequireParent("{46C969BF-3465-4E3E-B2A5-E404FB969735}"); } ``` ## SendDataToChildren Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/senddatatochildren/ `array SendDataToChildren(string $Data)` _Requires Symcon >= 4.0_ Sends data to all subordinate instances **Parameters** - `$Data` (string): JSON encoded string **Returns** (array): Results which [ReceiveData](module.md) delivers from the parent instances JSON encoded string **Example** ```php // The example can be found at ReceiveData ``` ## SendDataToParent Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/senddatatoparent/ `string SendDataToParent(string $Data)` _Requires Symcon >= 4.0_ Sends data to a higher-level instance **Parameters** - `$Data` (string): JSON encoded string **Returns** (string): Result which [ForwardData](module.md) delivers from the parent instance JSON encoded string **Example** ```php // Example can be found at ForwardData ``` ## SendDebug Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/senddebug/ `bool SendDebug(string $MessageName, string $Data, int $Format)` _Requires Symcon >= 4.0_ Sends a message to the debug output **Parameters** - `$MessageName` (string): Name/title of the debug output - `$Data` (string): Content of the debug message - `$Format` (int): Presetting for automatic formation selection (0 = text, 1 = hex) **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Presetting for automatic formation selection (0 = text, 1 = hex) **Example** ```php // Example from the presence simulation $this->SendDebug("Fetch", "Fetched day -".$day." with ".sizeof($data['Data'])." valid device(s)", 0); // Sample output automatically configured as text output in the debug window "Fetch" - "Fetched day -28 with 2 valid device(s)" ``` ## SetBuffer Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setbuffer/ `bool SetBuffer(string $Name, string $Data)` _Requires Symcon >= 4.1_ Sets the content of a buffer **Parameters** - `$Name` (string): Name of the buffer - `$Data` (string): Data which should be packed into the buffer. **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Data which should be packed into the buffer. **Example** ```php // Writes "Hello World" to the "Databuffer" buffer $this->SetBuffer("DataBuffer", "Hello World"); ``` ## SetForwardDataFilter Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setforwarddatafilter/ `bool SetForwardDataFilter(string $RequiredRegexRule)` _Requires Symcon >= 4.1_ Sets a “Regular Expression” filter for the ForwardData function **Parameters** - `$RequiredRegexRule` (string): RegexRule which should be used as a filter **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. RegexRule which should be used as a filter **Example** ```php // Add filter for ForwardData public function ApplyChanges(): void { [...] $this->SetForwardDataFilter(".*Hello.*"); [...] } // Only called if “Hello” is found in the $JSONString public function ForwardData(string $JSONString): string { return "OK"; } ``` ## SetReceiveDataFilter Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setreceivedatafilter/ `bool SetReceiveDataFilter(string $RequiredRegexRule)` _Requires Symcon >= 4.1_ Sets a "Regular Expression"-Filter for the RecieveData function **Parameters** - `$RequiredRegexRule` (string): Regexrule which should be used as a filter **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Regexrule which should be used as a filter **Example** ```php // Add filters for ReceiveData public function ApplyChanges(): void { [...] $this->SetReceiveDataFilter(".*Hello.*"); [...] } // Only called if “Hello” is found in the $JSONString public function ReceiveData(string $JSONString): string { return ""; } ``` ## SetStatus Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setstatus/ `bool SetStatus(int $StatusValue)` _Requires Symcon >= 4.0_ **Parameters** - `$StatusValue` (int): The status value to which the instance should be set. **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. The status value to which the instance should be set. **Example** ```php // sets the status to "inactive" $this->SetStatus(104); ``` ## SetSummary Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setsummary/ `bool SetSummary(string $ShortInfo)` _Requires Symcon >= 4.1_ Sets the short info of an object **Parameters** - `$ShortInfo` (string): Content to be set **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Content to be set **Example** ```php // puts a possible IP address in the short description to ensure quick recognition. $this->SetSummary($this->ReadPropertyString("IPAddress")); ``` ## SetTimerInterval Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/settimerinterval/ `bool SetTimerInterval(string $Name, int $Interval)` _Requires Symcon >= 4.0_ Sets the interval of a timer **Parameters** - `$Name` (string): The name of the timer whose interval is to be set. - `$Interval` (int): The interval, at which the timer should be set, in milliseconds. **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. The interval, at which the timer should be set, in milliseconds. **Example** ```php // Sets the interval of the "Update" timer to 5 seconds $this->SetTimerInterval("Update", 5000); ``` ## SetValue Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setvalue/ `bool SetValue(string $Ident, mixed $Value)` _Requires Symcon >= 5.0_ Sets the value of a status variable **Parameters** - `$Ident` (string): Ident of the status variable - `$Value` (mixed): Value to be written into the status variable. **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Value to be written into the status variable. **Example** ```php // Writes 123 into the status variable "Statusvariable1" $this->SetValue("Statusvariable1", 123); ``` ## SetVisualizationType Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/setvisualizationtype/ `SetVisualizationType(int $VisualisierungsTyp)` _Requires Symcon >= 7.1_ Sets the visualization type for the instance **Parameters** - `$VisualisierungsTyp` (int): Visualization type for individual visualization
__0__: no individual visualization
__1__: visualization via HTML SDK
__2__: Visualization via HTML SDK in normal tile view and full-screen mode (since 9.1)
[Constants](../sdk-php.md) **Returns** (): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Visualization type for individual visualization
__0__: no individual visualization
__1__: visualization via HTML SDK
__2__: Visualization via HTML SDK in normal tile view and full-screen mode (since 9.1)
[Constants](../sdk-php.md) **Example** ```text // Acivate HTML-SDK $this->SetVisualizationType(INSTANCE_VISUALIZATION_TYPE_HTML); ``` ## Translate Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/translate/ `string Translate(string $Text)` _Requires Symcon >= 4.3_ Translates a section of text **Parameters** - `$Text` (string): Text to be translated **Returns** (string): Translated text Text to be translated **Example** ```php // module.php $label = sprintf($this->Translate("The current time is %s"), date("d.m.y H:i")); // locale.json { "translations": { "de": { "The current time is %s": "Die aktuelle Zeit ist %s" } } } ``` ## UnregisterHook Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/unregisterhook/ `bool UnregisterHook(string $Address)` _Requires Symcon >= 8.2_ Unregisters a WebHook with the specified address **Parameters** - `$Address` (string): Address of the hook **Returns** (bool): If the command could be executed successfully, the result is __TRUE__, otherwise __FALSE__. Address of the hook **Example** ```php // IPSModuleStrict public function ApplyChanges(): void { ... $this->UnregisterHook('my-module'); ... } ``` ## UnregisterMessage Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/unregistermessage/ `bool UnregisterMessage(int $SenderID, int $MessageID)` _Requires Symcon >= 4.1_ Deactivates a message for a SenderID **Parameters** - `$SenderID` (int): ID of the sender - `$MessageID` (int): ID of the message **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. ID of the message **Example** ```php // The module no longer "listens" for messages from instance 12345 with MessageID 10505 $this->UnregisterMessage(12345 /* InstanceID */, 10505 /* IM_CHANGESTATUS */); // All messages from the module should be deleted foreach ($this->GetMessageList() as $senderID => $messages) { foreach ($messages as $message) { $this->UnregisterMessage($senderID, $message); } } ``` ## UnregisterOAuth Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/unregisteroauth/ `bool UnregisterOAuth(string $Identifier)` _Requires Symcon >= 8.2_ Unregisters an OAuth handler with the specified identifier **Parameters** - `$Identifier` (string): Identifier of the OAuth handler **Returns** (bool): If the command could be executed successfully, the result is __TRUE__, otherwise __FALSE__. Identifier of the OAuth handler **Example** ```php // IPSModuleStrict public function ApplyChanges(): void { ... $this->UnregisterOAuth('my-module'); ... } ``` ## UnregisterReference Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/unregisterreference/ `bool UnregisterReference(int $ID)` _Requires Symcon >= 5.1_ Removes an ID as referenced **Parameters** - `$ID` (int): ID of the object **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. ID of the object **Example** ```php $this->UnregisterReference(10505 /* ObjectID */); ``` ## UnregisterVariable Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/unregistervariable/ `bool UnregisterVariable(string $Ident)` _Requires Symcon >= 4.0_ Deletes a status variable **Parameters** - `$Ident` (string): Ident of the status variable **Returns** (bool): | Class | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------- | | IPSModuleStrict | boolean | Returns whether the variable has been removed. The return value can be used, for example, to clean up other things. | | IPSModule | boolean | If the command succeeds, it returns **TRUE**, otherwise **FALSE**. | Ident of the status variable **Example** ```php $this->UnregisterVariable("Temperature"); ``` ## UpdateFormField Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/updateformfield/ `bool UpdateFormField(string $Field, string $Parameters, mixed $Value)` _Requires Symcon >= 5.2_ Changes the parameter of a form field **Parameters** - `$Field` (string): Name of the form field to be changed - `$Parameters` (string): Name of the parameter to be changed - `$Value` (mixed): New value of the parameter **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. New value of the parameter **Example** ```php // hide the button $this->UpdateFormField("MyButton", "visible", false); ``` ## UpdateVisualizationValue Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/updatevisualizationvalue/ `bool UpdateVisualizationValue(mixed $Data)` _Requires Symcon >= 7.1_ Sends a message to the visualization when using the HTML SDK **Parameters** - `$Data` (mixed): Any data that is sent to the visualization **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Any data that is sent to the visualization **Example** ```text // In this example, a simple number is passed as the count $this->UpdateVisualizationValue(5); ``` ## WriteAttributeBoolean Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/writeattributeboolean/ `bool WriteAttributeBoolean(string $Name, bool $Value)` _Requires Symcon >= 5.1_ Writes an attribute of the Boolean type **Parameters** - `$Name` (string): Name of the attribute - `$Value` (bool): Value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Value of the attribute **Example** ```php $this->WriteAttributeBoolean("CurrentState", false); ``` ## WriteAttributeFloat Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/writeattributefloat/ `bool WriteAttributeFloat(string $Name, float $Value)` _Requires Symcon >= 5.1_ Writes an attribute of the Float type **Parameters** - `$Name` (string): Name of the attribute - `$Value` (float): Value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Value of the attribute **Example** ```php $this->WriteAttributeFloat("Median", 5.5); ``` ## WriteAttributeInteger Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/writeattributeinteger/ `bool WriteAttributeInteger(string $Name, int $Value)` _Requires Symcon >= 5.1_ Writes an attribute of the integer type **Parameters** - `$Name` (string): Name of the attribute - `$Value` (int): Value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Value of the attribute **Example** ```php $this->WriteAttributeInteger("SequenceCounter", 4); ``` ## WriteAttributeString Source: https://www.symcon.de/en/service/documentation/developer-area/sdk-tools/sdk-php/module/writeattributestring/ `bool WriteAttributeString(string $Name, string $Value)` _Requires Symcon >= 5.1_ Writes an attribute of the string type **Parameters** - `$Name` (string): Name of the attribute - `$Value` (string): Value of the attribute **Returns** (bool): If the command succeeds, it returns __TRUE__, otherwise __FALSE__. Value of the attribute **Example** ```php $this->WriteAttributeString("Token", "08da50bd109c7fb1bec49d15ae86e55f"); ```