TR50 Method

A TR50 method trigger event is executed when called by another portion of your solution. The TR50 method, including its notification variables and completion variables, are defined in the gateway's Thing definition. The deviceWISE Cloud provides the communication support between the TR50 Method event trigger and the calling portion of your solution. A TR50 Method event trigger is called by:

A thing method can optionally define:

  • Notification variables, which would be passed from the caller to the TR50 Method trigger
  • Completion variables, which would be passed from the TR50 Method trigger back to the caller.

Defining a TR50 Method event trigger

To define a TR50 Method event trigger, follow these steps:

  1. From the Workbench left pane, expand the node where you want to define the TR50 Method event trigger.
  2. Click Project icon to display the Projects window
  3. Right-click on a specific project to display its pop-up menu, and then select New.
    You also can select the New button at the bottom of the Projects window when a specific project tab has already been selected.
  4. The new Trigger window appears.
    Name the trigger. The trigger name can be up to 64 characters and include letters, numbers, and the underscore character. Spaces are allowed.
  5. From the Event tab, select the Trigger Event Type down-arrow, expand the Thing category, and then select TR50 Method.

    The Event tab becomes active with parameters that accommodate the TR50 Method event.
Parameter Description
TR50 Connection The TR50 connection to use to retrieve thing definition id information.

 (Optional) If not specified, the Default TR50 connection is used.

Thing Definition ID The Thing definition id, as defined in the deviceWISE Cloud. The Workbench retrieves the thing definitions from the deviceWISE Cloud based on the TR50 Connection parameter.
Thing Definition Method The Thing definition method, as defined in the deviceWISE Cloud. The methods are retrieved from the Thing definition specified by the Thing Definition ID parameter.

TR50 Method event type trigger event variables

The event variables available to a TR50 Method event trigger are:

Event variable Data type Description
Connection Name STRING The name of the TR50 connection that received this event.
From STRING The "caller" of the method. This can be:
  • The user ID, when the method is executed from the Management Portal -> Thing page -> Methods tab
  • The thing key, when the method is executed from a gateway or an external application using the API.
Message ID STRING A string that can be used to correlate the TR50 Method trigger execution with the caller. For example, using the Management Portal API Log.
ThingKey STRING The thing key of the thing that the thing method was defined for.
Input variables The data type of the configured input variable Each thing method notification variable will be available as an input event variable in the TR50 Method event trigger. These input event variables can be used as a source variable in the trigger's actions.
Output variables The data type of the configured output variable Each thing method completion variable will be available as an output event variable in the TR50 Method event trigger. These output event variables can be used as a destination variable in the trigger's actions.

Thing method, TR50 Method trigger and Execute Method action definition considerations

When defining a TR50 Method trigger, the Workbench obtains the information about thing methods by retrieving information from the deviceWISE Cloud specifically from the Organization that the TR50 Connection is defined to use.

A common trigger development pattern is:

  1. Define the thing method using the Management Portal. This centralized information will be accessed for you by the Workbench when defining the TR50 Method trigger and the calling Execute Method action. The definition of the thing method includes:
    • The name of the method
    • Input variables (will be supplied by the Execute Method action)
    • Send Response option of True or False
    • Output variables (when Send Response is True, returned from the TR50 Method trigger to the Execute Method action).
      For more information, see Defining Methods.
  2. Define the TR50 Method trigger on the gateway where it will execute. When defining the TR50 Method trigger, information is retrieved from the deviceWISE Cloud by the references to the:
    • TR50 Connection used to determine the Organization to retrieve the Thing definition information from.
    • Thing Definition ID
    • Thing Definition Method.
  3. Save the TR50 Method trigger.
  4. On the gateways that need to "call" or execute the TR50 Method trigger, define your triggers and add the Execute Method action.
    When defining the Execute Method action, the information is retrieved from the deviceWISE Cloud for all of the currently defined thing methods on gateways (things) that are in the same deviceWISE Cloud organization.
  5. Select the desired thing method and complete the assignment of any input and output variables.
  6. Save the trigger, which will include all of the thing method information retrieved from the deviceWISE Cloud on the specified Organization.
  7. When the trigger is edited again for any reason, the deviceWISE Cloud will be queried for the current thing method information.
  8. If the thing method is changed (for example: different input variables, Send Response option changed from False to True, change to output variables), all other triggers that use the thing method in an Execute Method action will need to be edited and updated.
Related Topics

Execute Method

method.exec action

method.exec

Trigger Thing keys and Thing definitions

SubTrigger

On-Demand