thing_def.update

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

Deleting a Defining Properties, Defining Alarms or Defining Attributes from a Thing definition will remove all the associated data (with history) of any Thing using the same Thing definition.

TR50 Request
{
  "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"
        }
      },
      "tunnelAdHoc": false,
      "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 are published.
autoDefProps Boolean Whether to automatically define properties as they are published.
controlTags Array   An array of control tags associated with the Thing definition
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.
tunnelAdHoc 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.
locations Object Key-value pairs of the location setting and value of the setting. See thing_def.create.
firmware Object An array of firmware definition objects. 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.
unset Array   An array of fields to unset. All optional parameters are allowed to be unset.

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

TR50 Response
{
  "cmd": {
    "success": true
  }
}