Support for Downlink Commands

Last modified: May 29, 2019 @ 13:17

Supported commands from DDM:

  • Read
  • Write
  • Execute

Not applicable / unsupported commands:

  • Read All
  • Create, Delete
  • Observe, Cancel Observe
  • Write Attributes
  • Discover
  • The HTTP response codes accepted for the downlink commands are: 2xx, 4xx, 5xx
  • All the topics and responses are case sensitive.

Prerequisites

  • The device should subscribe to the topic, ${endpoint}/commands.
  • The devices should publish to the Response topic ${endpoint}/responses for acknowledging the downlink command requests by DDM.

where, ${endpoint} stands for the MQTT client identifier. This is also called as “device identifier (endpoint)” in the DDM platform.

  • Set the value of “Max-in Flight Message count” as 1 in the setting category  “Device Message Queue”.

Supported Error Codes

Scenario Response code to DDM
When the device is connected and sends a response. As sent by the device (it should be 2xx, 4xx, 5xx).
If the response code differs from the above, the response is silently discarded.
When device is not connected (or) the device is not subscribed to the commands topic. 404 code is sent by application to DDM.
When the device is connected, but error occurs during publish on the broker. 408 code is sent by application to DDM.
When device is connected , but no response received. No response is sent by application to DDM.

After the expiry of the inflight message, DDM by itself aborts the command.

The downlink commands can be sent to a device using any REST API supported client. The example shown in this document is using Swagger.

  • Open the API Swagger link corresponding to the DDM instance in a web browser. The format of the Swagger link is <ddmaccesslink>-api
  • To explore the APIs, fill in the ‘bearer key’ and ‘device_network_id’.

You can copy the “bearer Key” and “device_network_id” from DDM.

Getting the bearer key

To get the bearer key from DDM, see Accessing the API.

Getting the Device Network ID

  • Navigate to About window in DDM GUI.

  • Copy and save the “Current Device Network ID”.

Getting the resource ID

  • Open a device from DDM and navigate to a smart object.

  • Click on a resource to navigate to a resource page.

For example, to navigate to ‘Application Type’, click on it. It will redirect you to ‘Application Type’ resource page of the device.

  • Copy the Resource ID from the URL and save for future.

  • In the swagger URL, paste both bearer key and device Network ID and click the ‘Explore’ button to fetch the resource list.