========== 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//name//description//plugin_id/ Return: like /list but with only the item added * /base/device_type/update/id//name//description//plugin_id/ Return: like /list but with only the item updated * /base/device_type/del/ 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": "{ "actuator": { "binary": {"state0":"Off", "state1":"On"}, "range": {"step":10, "unit":"%"}, "trigger": {}, "number": {} }, "sensor": {"boolean": {}, "number": {}, "string": {} } }", "id": "ventilation", "name": "Ventilation" }, "id": 2, "name": "testn" } .... ] } * /base/device/get/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/ 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//type_id//usage_id//description//reference/ Return: like /list but with only the item added * /base/device/addglobal/id/ * /base/device/xplcmdparams/id////...// * /base/device/xplstatparams/id////...// * /base/device/update/id//name//usage_id//description//reference/ Return: like /list but with only the item updated .. note:: type_id is not updatable * /base/device/del/ Return: like /list but with only the item deleted