trigger.template.update

The trigger.template.update command is used to update a cloud trigger template.

TR50 Request


                         {
  "1": {
    "command": "trigger.template.update",
    "params": {
      "id": "58b43ad4b2157c704f26005f",
      "name": "My trigger template",
      "desc": "A sample trigger template",
      "group": "basic samples",
      "naturalDesc": "When the [[temperaturePropertyKey]] exceeds [[propertyValue]], change the [[temperatureAlarmKey]] state to [[temperatureAlarmState]]",
      "fields": [
        {
          "key": "temperaturePropertyKey",
          "desc": "The thing property key for a temperature",
          "type": "string"
        },
        {
          "key": "propertyValue",
          "desc": "The property value lower threshold",
          "type": "number"
        },
        {
          "key": "temperatureAlarmKey",
          "desc": "The thing alarm key for a temperature",
          "type": "string"
        },
        {
          "key": "temperatureAlarmState",
          "desc": "The alarm state",
          "type": "number"
        }
      ],
      "trigger": {
        "desc": "Too hot",
        "eventType": "property.change",
        "event": {
          "thingKey": "$(event.thing.key)",
          "propKey": "[[temperaturePropertyKey]]",
          "operator": "gt",
          "operand": [[propertyValue]]
        },
        "actions": {
          "0": {
            "type": "alarm.publish",
            "params": {
              "thingKey": "$(event.thing.key)",
              "alarmKey": "[[temperatureAlarmKey]]",
              "state": [[temperatureAlarmState]]
            },
            "canvas": {
              "left": "241.846",
              "top": "236.830",
              "success": "success-end0"
            },
            "routes": {
              "success": "$endSuccess",
              "failure": "$endFailure"
            }
          }
        },
        "firstAction": "0",
        "canvas": {
          "event": {
            "left": "50.000",
            "top": "50.000"
          },
          "success-end0": [
            {
              "left": "261.824",
              "top": "304.754"
            }
          ]
        }
      }
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

id

String

Yes

The ID of the trigger template to update.

name

String

 

The name of the trigger template. Omit this field if it does not change.

desc

String

 

A description of the trigger template. Omit this field if it does not change.

group

String

 

An arbitrary label used to group templates. Omit this field if it does not change.

naturalDesc

String

 

A sentence (or set of sentences) that describe the trigger the template will generate, and how it's variables will be used. Omit this field if it does not change.

fields

Array

 

An optional array containing a structure of variables used to customize a trigger based on the trigger template. Omit this field if it does not change.

trigger

Array

 

The template used to create new triggers. For more information ,see trigger.create. Omit this field if it does not change.

sharedGlobal

Boolean

 

If this template should be globally available. Must have Super Ops permission to set this parameter.

TR50 Response

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


                        {
  "1": {
    "success": true
  }
}