Device Type Object

Describes the JSON object of a Device Type.

A Device Type in Ubidots can store parameters that can be applied to a new Device upon creation.

PropertyTypeDescription
urlStringUrl of Device Type
idStringId of Device Type
nameStringName of Device Type
labelStringLabel of Device Type
descriptionStringDescription of Device Type
deviceColorStringHTML Color of Device Type
deviceIconStringDevice Type Icon
variableColorStringHTML Color of Variables
syntheticVariableColorStringHTML Color of Synthetic Variables
variablesArray of ObjectsList of Variable Ids that belong to the Device Type
propertiesArray of ObjectsArray of Device properties
tagsArrayArray of tags of Device Type
tasksArray of ObjectsArray of Tasks of Device Type
createdAtStringDate Device Type was created

Variables Object

The variables object follows this structure

{
	"label": "", // Variable label
  "properties": {
    "_icon": "tasks", // Variable icon
    "_color": "#fabf5f", // Variable HTML Color
    "_offset": null, // Variable offset
    "_scale": null, // Variable scale
    "isLocationVariable": false, // True if variables is selected as location variable for the device
    "hidden": false, // True if variables is hidden
    "minimum_value": null, // Minimum value of the variable
    "maximum_value": null // Maximum value of the variable
  },
  "type": 0, // Options: [0 (Raw variable), 1 (Synthetic variable)]
  "name": "", // Variable name
  "description": "", // Variable description
  "tags": null, // Variable tags
  "derived_expr": "", // Variable expression. Only visible on synthetic variables
  "unit": "" // Variable unit
}

Each key represents the following:

Property

Type

Description

label

String

Label of Variable

properties

List

List of Variable properties, supported for:

  • _icon: Variable icon
  • _color: Variable HTML Color
  • _offset: Variable offset
  • _scale: Variable scale
  • isLocationVariable: True if variables is selected as location variable for the device
  • hidden: True if variables is hidden
  • minimum_value: Minimum value of the variable
  • maximum_value: Maximum value of the variable

type

Integer

Options: [0 (Raw variable), 1 (Synthetic variable)]

name

String

Variable name

description

String

Variable description

tags

Array

Array of Variable tags

derived_expr

String

Variable expression. Only visible on synthetic variables

unit

String

Variable unit

Tasks Object

The tasks object follow this structure:

{
	"id": "", // Task id
  "type": "Type of task", // Options: [event, device-group, dashboard] 
  "name": "{{device.name}}"
}

Each key represents the following

PropertyTypeDescription
idStringId of Task
typeStringType of task. Options: [event, device-group, dashboard]
nameStringName of the Task created

Device Type

{
    "url": "https://industrial.api.ubidots.com/api/v2.0/device_types/5e1f7e5789f9bd7c4e7f1e2c",
    "id": "5e1f7e5789f9bd7c4e7f1e2c",
    "name": "Type name",
    "label": "type-label",
    "description": "Default description",
    "deviceColor": "#3BA9F5",
    "deviceIcon": "pencil",
    "variableColor": "#FFAE58",
    "syntheticVariableColor": "#",
    "variables": [
    	   {
            "label": "battery",
            "properties": {
                "_icon": "battery-full",
                "_color": "#52b06b",
                "_offset": null,
                "_scale": null,
                "isLocationVariable": false,
                "hidden": false,
                "minimum_value": null,
                "maximum_value": null
            },
            "type": 0,
            "name": "Battery",
            "description": "",
            "tags": null,
            "unit": "%"
        },
        {
            "label": "plan",
            "properties": {
                "_icon": "tasks",
                "_color": "#fabf5f",
                "_offset": null,
                "_scale": null,
                "isLocationVariable": false,
                "hidden": false,
                "minimum_value": null,
                "maximum_value": null
            },
            "type": 0,
            "name": "Plan",
            "description": "",
            "tags": null,
            "unit": ""
        },
        {
            "label": "synthetic",
            "properties": {
                "_icon": "cloud-arrow-up",
                "_color": "#5AD0C2",
                "_offset": null,
                "_scale": null,
                "isLocationVariable": false,
                "hidden": false,
                "minimum_value": null,
                "maximum_value": null,
                "time_zone": "America/Bogota"
            },
            "type": 1,
            "name": "Synthetic",
            "description": "",
            "tags": null,
            "derived_expr": "{{battery}}+{{plan}}",
            "unit": "W"
        }
    ],
    "properties": [
      {
        "key": "p1",
        "text": "P1",
        "type": "text",
        "value": "Text as test",
        "description": "Description 1"
      },
      {
        "key": "p2",
        "text": "P2",
        "type": "number",
        "value": 10.0,
        "description": "Description 2"
      },
      {
        "key": "p3",
        "text": "P3",
        "type": "list",
        "value": "",
        "choices": [
          "t1",
          "t2"
        ],
        "options": [
          {
            "text": "t1",
            "value": "t1"
          },
          {
            "text": "t2",
            "value": "t2"
          }
        ],
        "description": "Description 3"
      },
      {
        "key": "p4",
        "text": "P4",
        "type": "date",
        "value": null,
        "description": "Description 4"
      },
      {
        "key": "p5",
        "text": "P5",
        "type": "boolean",
        "value": true,
        "description": "Description 5"
      },
      {
        "key": "p6",
        "text": "P6",
        "type": "json",
        "value": {},
        "description": "Description 6"
      }
    ],
    "tasks": [
    	  {
            "id": "658f54ba955ccd005174e67d",
            "type": "event",
            "name": "{{device.name}} Event"
        },
        {
            "id": "64b1cb4d7d9cef000c0ceab0",
            "type": "device-group",
            "name": "{{device.name}} Device Group"
        },
        {
            "id": "65c2fec389f8ab000eae12c3",
            "type": "dashboard",
            "name": "{{device.name}} Dashboard"
        }
    ],
    "createdAt": "2020-01-15T21:04:23.602975Z"
}