info.json for plugins - device_types section

Purpose

The device_types section describes all the Domogik device types that are handled by the plugin. A Domogikdevice type is a sort of device (for example an analog input, a digital input, a temperature sensor, a temperature and humidity sensor, …).

A device type is linked to some commands and some sensors. For example, a temperature sensor will have only a temperature sensor. A temperature and humidity sensor will have 2 sensors : a temperature sensor and a humidity sensor. In some technologies, an on/off lighting device type will have 1 command : on/off (which may be named switch) and a dimmer device type will have 2 commands: on/off (switch) and dimmer (which could be simply named dimmer).

Finally a device type has some parameters. For simple device type, there will be only one parameter : the device address. For some complex device type (some KNX or Chacon devices for example), you will have several parameters : the address which is split in 2 parts (chacon devices), the actuator address which is not the same as the sensor one (KNX devices), …

The known datatypes can be found in the file /var/lib/domogik/resources/datatypes.json.

Example 1

This example is the diskfree plugin. This plugin has only one device type named diskfree.disk_usage. This device type feature is to look at the disk space status on a filesystem. There are 4 informations which are available for this feature:

  • the total space available
  • the free space available
  • the used space
  • the percent of space used

These 4 informations are here given by 4 sensors.

To check these sensors the plugin need 2 information for the device type:

  • the path to look at on the filesystem
  • the interval between each check
"device_types": {
    "diskfree.disk_usage": {
        "description": "Disk usage",
        "id": "diskfree.disk_usage",
        "name": "Disk usage",
        "commands": [],
        "sensors": ["get_total_space", "get_percent_used", "get_free_space", "get_used_space"],
        "parameters": [
            {
                "key": "device",
                "xpl": true,
                "description": "The path to look at.",
                "type": "string"
            },
            {
                "key": "interval",
                "xpl": false,
                "description": "The time in minutes between each check.",
                "type": "integer"
            }
        ]
    }
}

Description

  • id : this is the device type id
  • name : the device type name
  • description : a short description of the device type
  • commands : the list of commands supported by this device type
  • sensors : the list of sensors supported by this device type
  • params : list of parameters that are common to ALL xpl messages for this device type
    • key : the xpl key for the message
    • xpl : is this an xpl parameter or nit, if set to true this parameter will be included in the xplcommands and expected in the xplstats/triggers, if set to false it will only be available internal in domogik or in the plugin if it requests the devices
    • description : short description of this field
    • type : the value type for this field. The available values are the same as the ones used in the configuration part of the json
    • default : Optionally a default value for this parameter, will be pre filled in in the admin interface during device creation
    • depending on the type the are other possibilities (like min_value, max_value, ….)