Skip to main content

Resource Model

A resource model is a unified way to describe the resources that the platform is able to handle, at this point in time the resources are:

  • Plugins
  • Device Type
  • Devices
  • Users

Plugins

Resource model that describe the information of the plugin once it's installed.

PropertiesDescription
idUnique identifier set by the platform
packageUnique identifier for the plugin that uses reverse domain name notation
versionVersion of the plugin
nameHuman readable name of the plugin
abstractShort description of the plugin
descriptionLong Description of the plugin
repositoryURL for the repository of the plugin
websiteWebsite of the plugin
emailContact email
licenseLicense of the project
authorsArray of the authors of the plugin
/plugins/1
{
"id": 1,
"package": "com.phillips.hue.bulbs",
"version": "2.1.0",
"name": "Phillips Hue",
"abstract": "Phillips hue bulbs simple control plugin",
"description": "Plugin that controls all the bulbs on phillips hue ecosystem",
"repository": "https://github.com/djinn/hue",
"website": "https://bulbs.hue.phillips.com/support",
"email": "[email protected]",
"license": "MIT",
"authors": [
{
"name": "John Doe",
"email": "[email protected]"
}
]
}

Device Type

The resource that describe the type of devices that are supported by the platform, the device type is associated to a plugin to map out which plugin can handle that device, it also

PropertiesDescription
idUnique identifier for the device in the platform
typeIdentifier for the type of device
pluginIdentifier of the plugin that controls this type of device
nameHuman readable name for the device type
propertiesKey value property that describe what are the attributes that expose the state of the device
commandsKey value property that describes the commands that are available and the commands that they can request
/types/1
{
"id": 1,
"name": "RGB Bulb",
"type": "rgb_bulb",
"properties": {
"light": {
"type": "boolean"
},
"intensity": {
"type": "number",
"format": "int",
"range": {
"min": 0,
"max": 100,
"enabled": true
}
},
"temperature": {
"type": "number",
"format": "float",
"units": "C"
}
},
"commands": {
"TURN_ON": {
"arguments": {
"light": {
"type": "boolean"
}
},
"response": {
"light": {
"type": "boolean"
}
}
},
"GET_TEMPERATURE": {
"arguments": null,
"response": {
"temperature": {
"type": "number",
"format": "float",
"units": "C"
}
}
}
}
}

Device

Resource model for a device

PropertiesDescription
idUnique identifier for the device in the platform
deviceIdentifier of the device, come from the manufacturer
nameHuman readable device name
typeIdentifier for the device type
stateCurrent state of the device
/devices/1
{
"id": 1,
"device": "1fba78c5-4ad9-452f-868f-1f41b64db5f9",
"name": "Name",
"type": "1fba78c5-4ad9-452f-868f-1f41b64db5f6",
"state": {
"light": {
"value": true
},
"temperature": {
"value": 100,
"unit": "C"
}
}
}

Users

Resource model for the user

PropertiesDescription
idUnique identifier for the device in the platform
nameName of the user
usernameUsername of the user
emailContact email of the user
/users/1fba78c5-4ad9-452f-868f-1f41b64db5f9
{
"id": "1fba78c5-4ad9-452f-868f-1f41b64db5f9",
"name": "John Doe",
"username": "johndoe",
"email": "[email protected]"
}