« Back to Product

Documentation

Module

Require: IP-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.

locale.json

Further information on the translation of the configuration page is available under Localizations.

module.json

This file contains frame information essential for identification and correct integration of the module.

Parameter Data type Description
id string Unique GUID for unique identification. GUID Generator
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, 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, 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.
{
    "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.

Warning

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.

Template minimal

// class definition
class ModulnameXYZ extends IPSModule {
    /**
    * 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 () {
        echo $this->InstanceID;
    }
}

Template classic

// class definition
class ModulnameXYZ extends IPSModule {
    // Overrides the internal IPS_Create($id) function
    public function Create() {
        // Don't delete this line
        parent::Create();
    }
    // Overwrites the internal IPS_ApplyChanges($id) function
    public function ApplyChanges() {
        // 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 () {
    // Self-created code
    }
}
Any questions?