REST /base

Devices and features management

Device type

Reading operations

  • /base/device_type/list/

Result:

{
    "status" : "OK",
    "code" : 0,
    "description" : "None",
    "device_type" : [
        {
            "description" : "None",
            "device_plugin_id" : "x10",
            "id" : "x10.switch.switch",
            "device_plugin" : {
                "description" : "",
                "id" : "x10",
                "name" : "X10"
            },
            "name" : "Switch"
        },
    ]
}

Writing operations

  • /base/device_type/add/id/<id>/name/<name>/description/<description>/plugin_id/<plugin_id>

Return: like /list but with only the item added

  • /base/device_type/update/id/<id>/name/<name>/description/<description>/plugin_id/<plugin_id>

Return: like /list but with only the item updated

  • /base/device_type/del/<id>

Return: like /list but with only the item deleted

Device

Reading operations

  • /base/device/list

Will only return devices where the address field is NULL

Result:

{
    "status": "OK",
    "code": 0,
    "description": "None",
    "device": [
        {
            "xpl_stat": [
                {
                    "name": "get_level",
                    "xpl_stat_param": [
                        {
                            "xplstat_id": 1,
                            "value": "81",
                            "ignore_values": "",
                            "sensor_id": "",
                            "static": "True",
                            "key": "address"
                        },
                        {
                            "xplstat_id": 1,
                            "value": "1",
                            "ignore_values": "",
                            "sensor_id": "",
                            "static": "True",
                            "key": "channel"
                        },
                        {
                            "xplstat_id": 1,
                            "value": "",
                            "ignore_values": "",
                            "sensor_id": 1,
                            "static": "False",
                            "key": "level"
                        }
                    ],
                    "json_id": "get_level",
                    "device_id": 2,
                    "id": 1,
                    "schema": "lighting.device"
                }
            ],
            "command": [
                {
                    "return_confirmation": "True",
                    "name": "Switch On or Off",
                    "reference": "set_level_bin",
                    "command_param": [
                        {
                            "values": "[0, 255]",
                            "value_type": "binary",
                            "key": "level",
                            "cmd_id": 1
                        }
                    ],
                    "xpl_command": {
                        "name": "blah",
                        "stat_id": 1,
                        "xpl_command_param": [
                            {
                                "value": "81",
                                "xplcmd_id": 1,
                                "key": "address"
                            },
                            {
                                "value": "1",
                                "xplcmd_id": 1,
                                "key": "channel"
                            },
                            {
                                "value": "dfad",
                                "xplcmd_id": 1,
                                "key": "dummy"
                            }
                        ],
                        "cmd_id": 1,
                        "json_id": "set_level_bin",
                        "schema": "lighting.basic",
                        "id": 1,
                        "device_id": 2
                    },
                    "id": 1,
                    "device_id": 2
                }
            ],
            "description": "",
            "reference": "",
            "xpl_command": [
                {
                    "name": "blah",
                    "stat_id": 1,
                    "xpl_command_param": [
                        {
                            "value": "81",
                            "xplcmd_id": 1,
                            "key": "address"
                        },
                        {
                            "value": "1",
                            "xplcmd_id": 1,
                            "key": "channel"
                        },
                        {
                            "value": "dfad",
                            "xplcmd_id": 1,
                            "key": "dummy"
                        }
                    ],
                    "cmd_id": 1,
                    "json_id": "set_level_bin",
                    "schema": "lighting.basic",
                    "id": 1,
                    "device_id": 2
                }
            ],
            "device_usage_id": "ventilation",
            "device_type": {
                "description": "Switch one channel on a device",
                "plugin_id": "velbus",
                "id": "velbus.relay",
                "name": "Switch"
            },
            "address": "",
            "device_type_id": "velbus.relay",
            "sensor": [
                {
                    "name": "level sensor",
                    "reference": "level",
                    "last_received": 1365315580,
                    "value_type": "number",
                    "values": "[0, 100]",
                    "last_value": "low",
                    "id": 1,
                    "unit": "%",
                    "device_id": 2
                }
            ],
            "device_usage": {
                "description": "Ventilation usage",
                "default_options": "{ &quot;actuator&quot;: { &quot;binary&quot;: {&quot;state0&quot;:&quot;Off&quot;, &quot;state1&quot;:&quot;On&quot;}, &quot;range&quot;: {&quot;step&quot;:10, &quot;unit&quot;:&quot;%&quot;}, &quot;trigger&quot;: {}, &quot;number&quot;: {} }, &quot;sensor&quot;: {&quot;boolean&quot;: {}, &quot;number&quot;: {}, &quot;string&quot;: {} } }",
                "id": "ventilation",
                "name": "Ventilation"
            },
            "id": 2,
            "name": "testn"
        }
        ....
    ]
}
  • /base/device/get/id/<id>

Return: same for as /list but only one device returned

  • /base/device/list-upgrade

Return: will return the datatstructure needed for device upgrade

  • /base/device/params/<device_type_id>

Return: The parameters needed for adding a new device, will return the needed global parameters and the command/stat specifick parameters

Result:

{
   "status": "OK",
   "code": 0,
   "description": "None",
   "deviceparams":
   [
       {
           "xpl_stat":
           [
               {
                   "params":
                   [
                   ],
                   "name": "get_level",
                   "schema": "lighting.device"
               },
               {
                   "params":
                   [
                   ],
                   "name": "get_level",
                   "schema": "lighting.device"
               }
           ],
           "xpl_cmd":
           [
               {
                   "params":
                   [
                       {
                           "type": "string",
                           "description": "a dummy param",
                           "key": "dummy"
                       }
                   ],
                   "xplstat_name": "get_level",
                   "name": "set_level_bin",
                   "schema": "lighting.basic"
               },
               {
                   "params":
                   [
                       {
                           "type": "string",
                           "description": "a dummy param",
                           "key": "dummy"
                       }
                   ],
                   "xplstat_name": "get_level",
                   "name": "set_level_bin",
                   "schema": "lighting.basic"
               }
           ],
           "global":
           [
               {
                   "max_value": 4,
                   "min_value": 1,
                   "type": "integer",
                   "description": "The channel number",
                   "key": "channel"
               },
               {
                   "max_value": 255,
                   "min_value": 0,
                   "type": "integer",
                   "description": "The decimal address",
                   "key": "address"
               }
           ]
       }
   ]
}

Writing operations

  • /base/device/add/name/<name>/type_id/<type_id>/usage_id/<usage_id>/description/<description>/reference/<reference>

Return: like /list but with only the item added

  • /base/device/addglobal/id/<device_id>
  • /base/device/xplcmdparams/id/<xplcommand id>/<param 1>/<value 1>/.../<param N>/<value N>
  • /base/device/xplstatparams/id/<xplparam id>/<param 1>/<value 1>/.../<param N>/<value N>
  • /base/device/update/id/<id>/name/<name>/usage_id/<usage_id>/description/<description>/reference/<reference>

Return: like /list but with only the item updated

Note

type_id is not updatable

  • /base/device/del/<id>

Return: like /list but with only the item deleted