thing_def.update

The thing_def.update command is used to update an existing Thing Definition.

TR50 Request

Warning:

Deleting an alarm, attribute, or property from a thing definition removes all associated data, including history, of any thing using the same thing definition.


{
  "cmd": {
    "command": "thing_def.update",
    "params": {
      "key": "mydef",
      "properties": {
        "brhum": {
          "name": "Bedroom Humidity",
          "suffix": "%rH",
          "unit": "%rH"
        },
        "brlight": {
          "name": "Bedroom Ambient Light",
          "suffix": "L",
          "unit": "Lumens"
        },
        "brtemp": {
          "name": "Bedroom Temperature",
          "suffix": "F",
          "unit": "F"
        },
        "lrhum": {
          "name": "Living Room Humidity",
          "suffix": "%rH",
          "unit": "%rH"
        },
        "lrlight": {
          "name": "Living Room Ambient Light",
          "suffix": "L",
          "unit": "Lumens"
        },
        "lrtemp": {
          "name": "Living Room Temperature",
          "suffix": "F",
          "unit": "F"
        },
        "offhum": {
          "name": "Office Humidity",
          "suffix": "%rH",
          "unit": "%rH"
        },
        "offlight": {
          "name": "Office Ambient Light",
          "suffix": "L",
          "unit": "Lumens"
        },
        "offtemp": {
          "name": "Office Temperature",
          "suffix": "F",
          "unit": "F"
        }
      },
      "locations": {
        "ignoreFixTypes": ["network", "m2m-locate"]
      }
    }
  }
}

Request Parameters

Name

Type

Required

Description

key

String

Yes

The key of the existing Thing Definition.

name

String

 

The name of the Thing Definition.

autoDefAttrs

Boolean

 

Whether to automatically define attributes as they're published.

autoDefProps

Boolean

 

Whether to automatically define properties as they're published.

alarms

Object

 

Key-value pairs where the key is the alarm key and the value is an alarm definition object.  See thing_def.create.

attributes

Object

 

Key-value pairs where the key is the attribute key and the value is an attribute definition object.  See thing_def.create.

methods

Object

 

Key-value pairs where the key is the method key and the value is a method definition object.  See thing_def.create.

properties

Object

 

Key-value pairs where the key is the property key and the value is a property definition object.  See thing_def.create.

tunnels

Object

 

Key-value pairs where the key is the tunnel key and the value is a tunnel definition object. See thing_def.create .

locations

Object

 

Key-value pairs of the location setting and value of the setting. See thing_def.create .

replace

Boolean

 

If set to true, fields will be completely replaced. This will unset alarms, attributes, methods, properties, and tunnels if no value is provided for them in the request.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.


                        {
  "cmd": {
    "success": true
  }
}