info.json for plugins - configuration section

Purpose

The configuration section describes the plugin configuration items. This part is only related to global configuration ! All the configuration elements which are related to a device are to be defined in the domogik device types part.

Example

For this example we assume that your plugin has this configuration item:

  • an interval item : if not configured, the default value configured in the json will be used y the plugin

Here is the corresponding section:

"configuration": [
    {
        "default": 5,
        "description": "Interval between each poll (minute)",
        "key": "interval",
        "name": "Interval",
        "required": false,
        "type": "integer",
        ...
    }

Notice about the auto_startup parameter

One parameter is automatically added by Domogik to your configuration parameters : the auto_startup element. The following data is dynamically added by Domogik when loading the info.json file:

{
    "default": false,
    "description": "Automatically start the plugin at Domogik startup",
    "key": "auto_startup",
    "name" : "Start the plugin with Domogik",
    "required": true,
    "type": "boolean"
}

This element allows the user to enable a plugin to be started on Domogik startup (useful during a server reboot).

Description

Each item has several properties:

  • key : the configuration key. This is used to store the value in database. The key must be lower case, limited to 255 characters. The only separator allowed in the underscore. This won’t be displayed on the user interface.
  • name : a human readable equivalent of the key. This wil be displayed on the user interface.
  • description : the configuration item description. If the item type is an integer, a float or something like this, you must specify the unity (minutes, seconds, ...) in the description.
  • type : the configuration item type. You will find more informations below.
  • default : the default value. If the configuration item is not set in database, this default value will be used by the plugin.
  • required : is the configuration of this item required to run the plugin ? On the user interface, you may not be able to start a plugin if all the required = true items are not filled. If the required key doesn’t exist, we assume that the item is required and required = true.
  • ... : some additional and optional parameters depending on the type. You will find more informations below.

Notice above special values

In json format, you need to use for the boolean type :

  • true
  • false

For undefined (None in python, undefined in javascript, Null in Java) values :

  • null

auto_startup

The auto_startup item must be set for all the plugins. This allow the user to configure on the user interface if he wants the plugin to be started on Domogik startup. The default value must be false.

The hidden configuration item : configured

An hidden configuration item exists : configured. It is set to true in database when a plugin is configured and deleted when the plugin configuration is cleaned (this is done on dbmgr side). This item allows to check if a plugin si configured before starting it. If the plugin is not configured, it won’t start!

Data types

Notice that when retrieving the plugins values for the configuration elements, they are automatically casted in the appropriate format which is the one describe in this part of the json file!

Here are some type examples:

  • Boolean
  • String
  • ...

Please check the most of all available field types.