SCI (Server Command Interface)

SCI (Server Command Interface) is a web service that allows users to access information and perform commands that relate to their device.

Examples of SCI requests include:

  • Retrieve live or cached information about your device(s)
  • Change settings on your device(s)
  • Interact with a Python program running on your device(s) to send commands or retrieve information
  • Read from and write to the file system on your device(s)
    • Update your Python applications
    • Retrieve data stored locally on your device(s)
  • Update device firmware
  • Update XBee radio firmware on your device(s)
  • Remotely reboot your device(s)

The operations can be performed synchronously or asynchronously. Synchronous requests are useful if you would like to execute a short request to the server and block until the operation is completed. Asynchronous requests are useful when you want to execute a request that has the possibility of taking a while to complete or you simply want to send the request off and return immediately. With asynchronous requests, you receive an ID that you can later use to check on the job status and retrieve results.

An SCI request is composed of XML that is posted to http(s)://<hostname>/ws/sci.

© 2023 Digi International Inc. All rights reserved.

SCI Request

Every SCI request looks like the following:

<sci_request version="1.0">
    <{operation_name}>
        <targets>
          {targets}
        </targets>
          {payload}
    </{operation_name}>
</sci_request>

operation_name is either send_message, update_firmware, disconnect, or query_firmware_targets

targets contains one or more elements that look like: <device id="{device_id}"/>, <device id="all"/>, <device tag="{tag name}"/>, or <group path="{group name}"/>

payload is dependent on the operation

File Reference

The payload for an SCI command can be referenced from a file in Remote Manager Data Services as opposed to being explicitly described in the actual request. For example, the following SCI request payload is referenced instead of explicitly declared in the XML:

<sci_request version="1.0">
    <send_message>
        <targets>
            <device id="00000000-00000000-00000000-00000000"/>
        </targets>
        <file>/~/my_commands/set_settings.xml</file>
    </send_message>
</sci_request>

Where the content of set_settings.xml could be similar to the following:

<rci_request>
   <set_setting>
      <query_setting>....</query_setting>
   </set_setting>
</rci_request>

© 2023 Digi International Inc. All rights reserved.

SCI Targets

Each element under Targets can be thought of as an OR statement, thus you can specify multiple group paths, and it will effect each path specified.

The targets field within an SCI request can be one of the following elements:

  • <device id="{device_id}"/> When included in an SCI request, this element specifies a particular device ID. Requests issued will only be sent to the specified device.
  • <device id="all"/> When included in an SCI request, this element specifies the device IDs of all of your Remote Manager-registered devices. Requests issued will be sent to all of the devices registered within your Remote Manager user account.
  • <device tag="{tag name}"/> When included in an SCI request, this element specifies a particular tag name. Requests issued will be sent to all of the devices containing the specified tag name.
  • <group path="{group name}"/> When included in an SCI request, this element specifies a particular group name. Requests issued will be sent to each of the devices contained within the specified group.

© 2023 Digi International Inc. All rights reserved.

Synchronous Requests

Synchronous request using a device ID

POST the following to: /ws/sci

<!-- common to every sci request -->
<sci_request version="1.0">
    <!-- indicates we want to send an rci request -->
   <send_message>
      <!-- preparing us for the list of who to operate on -->
      <targets>
         <!-- we will send it to this device -->
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <!-- the payload for the send_message command, an rci request -->
      <rci_request version="1.1">
         <query_state>
            <device_stats />
         </query_state>
      </rci_request>
   </send_message>
</sci_request>

which returns when the operation has completed (or timed out) and the body of the response will be:

<sci_reply version="1.0">
<!-- start of the sci response --> 
<send_message>
  <!-- the "operation" of our sci_request -->
   <device id="00000000-00000000-00000000-00000000">
      <!-- contains the response for this device -->
      <rci_reply version="1.1">
          <!-- the rci response for the particular device -->
         <query_state>
            <device_stats>
               <cpu>36</cpu>
               <uptime>152</uptime>
               <datetime>Thu Jan 1 00:02:32 1970 (based on uptime)</datetime>
               <totalmem>8388608</totalmem>
               <usedmem>5811772</usedmem>
               <freemem>2576836</freemem>
            </device_stats>
         </query_state>
      </rci_reply>
   </device>
</send_message>

Synchronous request using a group path

POST the following to /ws/sci

<!-- common to every sci request -->
    <sci_request version="1.0">
       <!-- indicates we want to send an rci request -->
       <send_message>
          <!-- preparing us for the list of who to operate on -->
          <targets>
             <!-- we will send it to this group -->
             <group path="group1" />
          </targets>
          <!-- the payload for the send_message command, an rci request -->
          <rci_request version="1.1">
             <query_state>
                <device_stats />
             </query_state>
          </rci_request>
       </send_message>
    </sci_request>

which will return when the operation has completed (or timed out) and the body of the response will be:

Note The return will contain a response for each device included within the specified group.

   <sci_reply version="1.0">
    <!-- start of the sci response -->
    <send_message>
      <!-- the "operation" of our sci_request -->
       <device id="00000000-00000000-00000000-00000001">
          <!-- contains the response for the first device in the specified group -->
          <rci_reply version="1.1">
            <!-- the rci response for the first device in the specified group -->
             <query_state>
                <device_stats>
                   <cpu>22</cpu>
                   <uptime>237565</uptime>
                   <totalmem>8388608</totalmem>
                   <usedmem>7136532</usedmem>
                   <freemem>1252076</freemem>
                </device_stats>
             </query_state>
          </rci_reply>
       </device>
       <device id="00000000-00000000-00000000-00000002">
          <!-- contains the response for the second device in the specified group -->
          <rci_reply version="1.1">
            <!-- the rci response for the second device in the specified group -->
             <query_state>
                <device_stats>
                   <cpu>42</cpu>
                   <uptime>438054</uptime>
                   <datetime>Mon Jun 28 19:36:29 2010</datetime>
                   <totalmem>8388608</totalmem>
                   <usedmem>8165060</usedmem>
                   <freemem>223548</freemem>
                </device_stats>
             </query_state>
          </rci_reply>
       </device>
    </send_message>
    <sci_request>

Synchronous request using a device tag:

POST the following to: /ws/sci

<!-- common to every sci request -->
<sci_request version="1.0">
 <!-- indicates we want to send an rci request -->
<send_message>
   <!-- preparing us for the list of who to operate on -->
   <targets>
      <!-- we will send it all devices that have this tag -->
      <device tag="tag1" />
   </targets>
   <!-- the payload for the send_message command, an rci request -->
   <rci_request version="1.1">
      <query_state>
         <device_stats />
      </query_state>
   </rci_request>
</send_message>
</sci_request>

which will return when the operation has completed (or timed out) containing responses from all of the devices matching the specified tag.

© 2023 Digi International Inc. All rights reserved.

Asynchronous Requests

SCI requests that are asynchronous return without waiting for the request to finish, and return a job ID that can be used to retrieve the status and results later.

If you POST an SCI request asynchronously and want to see the results, the general flow is:

POST the SCI request.

if rc=202 // The job is accepted
      get the location from the response header or the job ID from the response content
      rc = HEAD location
      while rc!=200
            sleep for a number of seconds
            rc = HEAD location
      GET location
      process your results
      DELETE location

Performing an Asynchronous Request

A synchronous request is performed by specifying synchronous=“false” in the element specifying the operation in the request, e.g.: <send_message synchronous="false">

the response then has the form:

<sci_reply version="1.0">
   <send_message>
      <jobId>{job_id}</jobId>
   </send_message>
</sci_reply>

where job_id identifies the request you submitted.

Retrieve Status

You can retrieve the status for a particular request, or retrieve information about submitted requests overall.

Status for a Particular Job

Do an HTTP GET on /ws/sci/{job_id}

To determine if a job is complete, do an HTTP HEAD specifying the job ID; /ws/sci/601358. A return code of 200 means the job is complete.

Overall Status of Outstanding Jobs

Do an HTTP GET on /ws/sci, and you will get a response that looks like:

<result>
   <resultTotalRows>1</resultTotalRows>
   <requestedStartRow>0</requestedStartRow>
   <resultSize>1</resultSize>
   <requestedSize>1000</requestedSize>
   <remainingSize>0</remainingSize>
   <Job>
      <jobId>601358</jobId>
      <cstId>0</cstId>
      <usrId>0</usrId>
      <jobType>0</jobType>
      <jobSyncMode>0</jobSyncMode>
      <jobReplyMode>0</jobReplyMode>
      <jobTargets>00000000-00000000-0004F3FF-00000000</jobTargets>
      <jobRequestPayload>&lt;rci_request&gt;&lt;query_setting/&gt;&lt;/rci_request&gt;</jobRequestPayload>
      <jobDescription>query_setting</jobDescription>
      <jobStatus>2</jobStatus>
      <jobTargetCount>1</jobTargetCount>
      <jobProgressSuccess>1</jobProgressSuccess>
      <jobProgressFailures>0</jobProgressFailures>
      <jobSubmitTime>2010-03-02T15:36:22Z</jobSubmitTime>
      <jobCompletionTime>2010-03-02T15:36:22Z</jobCompletionTime>
   </Job>
</result>

where jobId is the ID for the request. jobType is the type of the job (0: send_message, 1: update_firmware, 2: disconnect). jobSyncMode indicates if the job is synchronous (0: synchronous, 1: asynchronous). jobReplyMode indicates the reply mode (0: all, 1: none, 2: only), where only means only return errors. jobStatus is the current status of the job (0: new, 1: in_progress, 2: complete, 3: canceled). jobTargetCount is the number of devices the job is targeted for. jobProgressSuccess is the number of devices that have completed the operation successfully. jobProgressFailures is the number of devices that have completed the operation with an error.

Retrieve Progress

You can retrieve the progress for a particular SCI job by specifying the progress=true parameter. For example:

HTTP GET https://remotemanager.digi.com/ws/sci/{job_id}?progress=true

This will return the current progress (percent completion) for an SCI job, as well as its progress history. For example, let’s assume we have an SCI job that is performing a firmware update on two different devices. Performing the query shown above will give a response that looks something like:

<sci_reply version="1.0">
   <status>in_progress</status>
   <update_firmware>
      <device id="00000000-00000000-000000FF- FF000001">
         <progress time="Mon Nov 28 21:30:25 UTC 2011" status="0">Getting Target Info</progress>
         <progress time="Mon Nov 28 21:30:27 UTC 2011" status="0">Sending Download Request</progress>
         <progress time="Mon Nov 28 21:31:15 UTC 2011" status="5">Sending Data: 156672 out of 3130662 bytes sent</progress>
         <progress time="Mon Nov 28 21:32:07 UTC 2011" status="10">Sending Data: 313344 out of 3130662 bytes sent</progress>
      </device>
      <device id="00000000-00000000-000000FF- FF000002">
         <progress time="Mon Nov 28 21:30:26 UTC 2011" status="0">Getting Target Info</progress>
         <progress time="Mon Nov 28 21:30:27 UTC 2011" status="0">Sending Download Request</progress>
         <progress time="Mon Nov 28 21:31:05 UTC 2011" status="5">Sending Data: 156672 out of 3130662 bytes sent</progress>
         <progress time="Mon Nov 28 21:31:48 UTC 2011" status="10">Sending Data: 313344 out of 3130662 bytes sent</progress>
         <progress time="Mon Nov 28 21:32:30 UTC 2011" status="15">Sending Data: 470016 out of 3130662 bytes sent</progress>
      </device>
   </update_firmware>
</sci_reply>

We can also query for job progress on other types of SCI jobs, including file uploads through the File System service. Progress updates for file uploads through RCI is not supported.

Cancel a Request or Delete the Results

Do an HTTP DELETE on /ws/sci/{job id}

This will attempt to cancel the request. Some parts of the request may have already completed, and parts of the request that are in progress may continue to completion, but it should prevent any operations that have not yet begun from starting.

© 2023 Digi International Inc. All rights reserved.

Available Operators

Introduction

Available operators include:

send_message allows an RCI request to be sent to the device (or the server cache).

update_firmware updates the firmware of the device.

disconnect sends a request to the device to disconnect from the server.

ping determines the round trip latency of a device connection.

query_firmware_targets gets a list of firmware targets on the device.

file_system is used to interact with files on a device. This interface is for use with devices supporting the file_system service (as opposed to other devices that support file_system interaction through RCI requests.) The RCI do_command for file_system is only supported by older devices not implementing the file_system service.

data_service sends messages to devices over the data service.

reboot issues a reboot for a device.

There are a few attributes that can be specified for an operation that can specify the behavior. They include:

<{operation_name} reply="all|errors|none"> 
<{operation_name} synchronous="true|false"> 
<{operation_name} syncTimeout="xxx">
<{operation_name} cache="true|false|only">
<{operation_name} allowOffline="true|false">
<{operation_name} waitForReconnect="true|false">

reply determines how much information should be saved in the response to a request.

all (default) means that everything should be saved.

errors implies that only errors in the response should be kept, while success messages should not be saved.

none means that result data for the operation should not be saved.

errors is useful if you are performing an operation and only want to see error information that occurred, such as when setting settings, or performing firmware update. none is useful when you aren’t concerned with the reply at all. If you are performing a synchronous request because you want to wait until the operation is complete, but do not want to receive a lot of data in the reply, this would accomplish that.

synchronous determines whether the request should be sent synchronously (default), or asynchronously (false).

syncTimeout is applicable for a synchronous request and determines how long to wait for the request to complete (in seconds) before an error is returned. The default changes based on the type. The overall timeout for the SCI request will be the accumulation of all operations combined. Unless overridden with syncTimeout, the timeouts on send_message commands are as follows:

operation timeout
default 1 min
do_command target=“file_system” 10 min
do_command target=“zigbee” 5 min
firmware update 5 min

cache determines if the request should be processed on the server if possible, or always sent to the device. Options include:

  • true (default) means that if possible, the request will be processed from the server cache without being sent to the device. If it cannot, it will be sent to the device.
  • false means that the request will bypass the server cache and be sent to the device.
  • only means that the request should only be processed by the server cache and will never be sent to the device, even if the server is not capable of servicing the request.

allowOffline determines if this should be an offline operation. Offline operations enable you to send a request to a device that is currently disconnected. If the device is already connected, then Remote Manager will execute the command right away. If the device is not connected, then Remote Manager will execute the command as soon as the device connects to Remote Manager. Offline requests can be specified by setting the allowOffline attribute to “true”.

NOTES:

  • By default, SCI requests are synchronous. For offline operations, it is recommended to use an asynchronous request by setting the synchronous attribute to “false”.
  • Asynchronous offline operations will timeout after 7 days.
  • If for some reason the device disconnects during processing, the operation will automatically be retried again the next time the device connects. Offline operations will be retried up to 5 times before failing.

waitForReconnect allows the completion of a command to depend on a device reconnecting. For example, normally sending a reboot command to a device would result in the command being marked as successfully completed as soon as the device acknowledges the reboot request. However, in many instances, it may make sense to wait to mark the command as successful until the device reconnects to Remote Manager. In such cases, this can be achieved by setting the waitForReconnect attribute to “true”.

Warning: Many commands do not result in the device disconnecting and reconnecting to Remote Manager, meaning that improper use of this setting could result in the request taking an indefinite amount of time to complete; use caution when using this setting.

send_message

This is used to send an RCI request to a device. The reply will contain the response from the devices or groups of devices, or any error messages. A device ID of all will cause the RCI request to be sent to all devices available to the user.

One of the main uses of RCI requests are to interact with the settings and state of a device. Remote Manager keeps a cache of the latest settings and state that it has received from a device, and this makes it possible to retrieve information about the state or settings of a device without having to go to the device.

The format of the send_message command is as follows:

<sci_request version="1.0">
   <send_message>
      <targets>{targets}</targets>
      <rci_request version="1.1">
         <!-- actual rci request -->
      </rci_request>
   </send_message>
</sci_request>

query_setting

Request for device settings. May contain setting group elements to subset query (only setting group subset supported. Subsetting below this level not supported).

Returns requested config settings. Requests specifying no settings groups (e.g. return all settings).

set_setting

Set settings specified in setting element. Settings data required.

Empty setting groups in reply indicate success. Errors returned as error or warning elements.

query_state

Request current device state such as statistics and status. Sub-element may be supplied to subset results.

Returns requested state. Requests specifying no groups (e.g. return all state).

Example:

<query_state>
  <device_stats/>
</query_state>

reboot

Reboots device immediately.

do_command

The do_command is a child element of an RCI Request that is executed differently based on the value of its target attribute. Note that the command may not be supported for use with your device. See the file_system service.

Python You can add callbacks to unhandled do_commands target via the rci python module on a device.

Zigbee

The zigbee rci command interacts with an xbee module.

ZigBee Discover

Returns back a list of discovered nodes, with the first indexed node being the node in the gateway.

Optional attributes:

  • start says the rci should return the nodes whose index is >= start. For some reason, if start > 1, the Gateway will return this list from cache, and not perform an actual discovery.
  • size Determines number of nodes to return
  • clear If this is set to “clear”, it forces a clearing of the device’s cache, and will always perform a discover to get fresh results

Example:

<do_command target="zigbee">
  <discover start="1" size="10" option="clear"/>
</do_command>

ZigBee Query Setting

Returns back a detailed list of settings for a given radio

Optional attribute:

  • addr 64 bit address of the node to retrieve settings for. If omitted, defaults to gateway node

Example:

<do_command target="zigbee">
  <query_setting addr="00:13:a2:00:40:34:0c:88!"/>
</do_command>

ZigBee Query State

This is identical to query_setting, except it returns back different fields.

ZigBee Set Setting

Basically the reverse of query_setting, so you can set settings for a particular node

Optional attributes:

  • addr 64 bit address of node to set settings for. If omitted, defaults to gateway node

Example:

<do_command target="zigbee">
<set_setting addr="00:13:a2:00:40:34:0c:88!">
     <radio>
         <field1>value1</field1>
         ...
         <fieldn>valuen</fieldn>
     </radio>
</set_setting>
</do_command>

ZigBee Firmware Update

Updates the firmware of the radio in the gateway

Required attribute:

  • file Path to a firmware file which must already exist on the gateway

Example:

<do_command target="zigbee">
  <fw_update file="/WEB/firmware_file"/>
</do_command>

update_firmware

This is used to update the firmware of one or more devices. The firmware image can be hosted in your Data Services directory on Remote Manager, or can be Base64 encoded and placed in a data element within the update firmware command. The response marks each device as either submitted or failed. A response of “Submitted” means the process to send the firmware and update request to Remote Manager completed successfully.

It is still possible for the process to fail between Remote Manager and the device. You will need to go back and verify that the device firmware version has actually changed. You can do this by using the DeviceCore request defined earlier. You may also use the RCI command “query_state”.

There are optional attributes filename, and firmware_target, which are included with the update_firmware element.

filename needs to be specified if your target device supports multiple targets that can be updated in order to choose which to upgrade. These will match patterns specified by the device which can be discovered using the query_firmware_targets command.

firmware_target can be used to bypass the filename matching and force an upgrade on a particular target.

A request using a Base64 encoded file looks like:

<sci_request version="1.0">
   <update_firmware filename="abcd.bin">
      <targets>{targets}</targets>
      <data>{base64 encoded firmware image}</data>
   </update_firmware>
</sci_request>

and the reply looks like:

<sci_reply version="1.0">
   <update_firmware>
      <device id="00000000-00000000-00000000-000000">
         <submitted />
      </device>
   </update_firmware>
</sci_reply>

To do the update operation with a file stored in Remote Manager Data Services, use the <file> attribute:

<sci_request version="1.0">
    <update_firmware filename="abcd.bin">
        <targets> 
            {targets} 
        </targets>
        <file>~/firmware/abcd.bin</file> 
    </update_firmware> 
</sci_request>

The above example assumes that you created a directory called “firmware” off the root of your home directory in Data Services. “~” is an alias to the home directory of your account.

disconnect

Disconnect is used to indicate that a device should disconnect from the server. Based on the device’s configuration, it will likely reconnect.

A request follows this format:

<sci_request version="1.0">
   <disconnect>
      <targets>{targets}</targets>
   </disconnect>
</sci_request>

and a response looks like:

<sci_reply version="1.0">
   <disconnect>
      <device id="00000000-00000000-00000000-00000000">
         <disconnected />
      </device>
   </disconnect>
</sci_reply>

ping

Ping is used to determine the round trip latency of a device connection. The result gives the actual time used to send a simple command to the device and receive a reply.

A request follows this format:

<sci_request version="1.0">
    <ping>
       <targets>
          <device id="00000000-00000000-00042DFF-FF04A85A"/>        
       </targets>
    </ping>
</sci_request>

The sample response contains the actual time used to send a simple command to the device and receive a reply.

<sci_reply version="1.0">
    <ping>
      <device>
             <device id="00000000-00000000-00042DFF-FF04A85A">
             <time>
             	<device units="ms">5</device>
             </time>
       </device>
    </ping>
</sci_reply>

query_firmware_targets

Query Firmware Targets is used to retrieve information about the upgradeable firmware targets of a device. It will return the target number, name, version, and code size. A pattern may also be returned in the response which indicates a regular expression that is used to determine the appropriate target for a given filename.

A request follows this format:

<sci_request version="1.0">
   <query_firmware_targets>
      <targets>{targets}</targets>
   </query_firmware_targets>
</sci_request>

and a response looks like:

<sci_reply version="1.0">
   <query_firmware_targets>
      <device id="00000000-00000000-00000000-00000000">
         <targets>
            <target number="0">
               <name>Firmware Image</name>
               <pattern>image\.bin</pattern>
               <version>7.5.0.11</version>
               <code_size>2162688</code_size>
            </target>
            <target number="1">
               <name>Bootloader</name>
               <pattern>rom\.bin</pattern>
               <version>0.0.7.5</version>
               <code_size>65536</code_size>
            </target>
            <target number="2">
               <name>Backup Image</name>
               <pattern>backup\.bin</pattern>
               <version>7.5.0.11</version>
               <code_size>1638400</code_size>
            </target>
         </targets>
      </device>
   </query_firmware_targets>
</sci_reply>

file_system

The file system command is used to interact with files on a device. This interface is for use with devices supporting the file system service (as opposed to other devices which support file system interaction through RCI requests).

Commands have the following general format:

<sci_request version="1.0">
   <file_system>
      <targets>{targets}</targets>
      <commands>{one or more file_system commands}</commands>
   </file_system>
</sci_request>

Support file system commands are as follows:

put_file

The put_file command is used to push new files to a device, or optionally write chunks to an existing file.

  • path is a required attribute giving the file to write to.
  • offset is an optional attribute specifying the position in an existing file to start writing at.
  • truncate is an optional attribute indicating the file should be truncated to the last position of this put.

The payload is specified in one of two ways:

  1. Child element data with the payload Base64 encoded
  2. Child element file with a path to a file in storage to send

Example: A put file operation using a file on the server as the source for the data. The contents will be inserted into the file /path_to/write1.ext, as offset 200. It is set to not truncate the file if it extends beyond the length of written data.

<sci_request version="1.0">
   <file_system>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <commands>
         <put_file path="/path_to/write1.ext" offset="200" truncate="false">
            <file>~/referencedfilename.xml</file>
         </put_file>
      </commands>
   </file_system>
</sci_request>

A put file with the data Base64 encoded and embedded in the request under the data element. Offset and truncate are not specified, so this example will create a new file if one does not exist, or overwrite an existing one.

<sci_request version="1.0">
   <file_system>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <commands>
         <put_file path="/path_to/write2.ext">
            <data>ZmlsZSBjb250ZW50cw==</data>
         </put_file>
      </commands>
   </file_system>
</sci_request>

get_file

The get_file command is used to retrieve a file from the device, either in its entirety or in chunks. There is currently a restriction such that the maximum retrieval size is 10MB. As a result, files greater than this size will have to be retrieved in chunks.

  • path is a required attribute giving the file to retrieve.
  • offset is an optional attribute specifying the position to start retrieving from.
  • length is an optional attribute indicating the length of the chunk to retrieve.

Example: The get file in this example will retrieve 64 bytes starting at offset 100 from the file /path_to/file.ext. Leaving off offset and length would cause the full file to be retrieved.

<sci_request version="1.0">
   <file_system>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <commands>
         <get_file path="/path_to/file.ext" offset="100" length="64" />
      </commands>
   </file_system>
</sci_request>

ls

The ls command is used to retrieve file listings and details.

  • path is a required attribute specifying where to get file details for.
  • hash is an optional attribute which indicates a hash over the file contents should be retrieved. Values include none, any, md5, sha-512, sha3-512, and crc32. Use any to indicate the device should choose its best available hash. (If you specify md5, sha-512, sha3-512, or crc32, the device may not support the hash or any hash mechanism).

Example: This ls request will return a listing of the contents of /path_to_list. By specifying hash=“any”, the response will include the most optimal hash available, if any. Leaving off the hash attribute will default it to none.

<sci_request version="1.0">
   <file_system>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <commands>
         <ls path="/path_to_list" hash="any" />
      </commands>
   </file_system>
</sci_request>

rm

The rm command is used to remove files.

  • path is a required attribute specifying the location to remove.

Example: This rm request will attempt to delete /path_to/file.ext

<sci_request version="1.0">
   <file_system>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <commands>
         <rm path="/path_to/file.ext" />
      </commands>
   </file_system>
</sci_request>

data_service

A new subcommand in SCI is now supported to send messages to a device over the data service. The command element is data_service, and it must contain an element requests. The requests element contains a device_request element, with required attribute target_name and optional attribute format. target_name specifies the data service target the request will be sent to. The text data contained in the device_request element is used as the payload for the request. If format is not specified, the content will be sent as text. If format=“base64” is specified, the content will be Base64 decoded and sent to the target as a binary payload.

Example of text payload

<data_service>
   <targets>
      <device id="00000000-00000000-00000000-00000000" />
   </targets>
   <requests>
      <device_request target_name="myTarget">my payload string</device_request>
   </requests>
</data_service>

Example of binary payload

<data_service>
   <targets>
      <device id="00000000-00000000-00000000-00000000" />
   </targets>
   <requests>
      <device_request target_name="myBinaryTarget" format="base64">YmluYXJ5ZGF0YS4uLg==</device_request>
   </requests>
</data_service>

reboot

Reboot is used to issue a reboot for a device. The majority of devices may not support this operation, and will instead support reboot through RCI. This option exists as an alternative for devices that may not support RCI.

Example:

<reboot>
   <targets>
      <device id="00000000-00000000-00000000-00000000" />
   </targets>
</reboot>

© 2023 Digi International Inc. All rights reserved.

RCI (Remote Command Interface)

RCI (Remote Command Interface) is a mechanism that allows remote configuration, control, and information exchange between an RCI client, typically a web services client acting via Remote Manager, and an RCI target, typically a Digi device implementing the RCI specification.

RCI consists of a transport mechanism, such as the Remote Manager device protocol, EDP, and an XML-based request and reply document specification. For complete information on RCI, see Remote Command Interface (RCI) specification.

© 2023 Digi International Inc. All rights reserved.

Sms Messages

There are two types of SMS data:

  • Data: Data SMS messages are sent from the device using the python function idigisms_send() and the messages are stored in FileData (see FileData).Data from the device is stored as a file in storage:
    • Python programs specify the data contents and optionally the file name, called the path in idigisms_send().
    • If a path is not specified, the file is stored with the name SmsUnnamed. If the fdArchive option is true, the file is archived.
  • DIA data: Remote Manager parses DIA (Device Integration Application) messages and adds the parsed messages to the DIA data specific storage or as a file in generic storage depending on whether the device has a DIA Data Management service subscription (see DIA (device integration application).

© 2023 Digi International Inc. All rights reserved.

Sending Sms Messages

Remote Manager sends SMS requests to registered devices using the SCI (Server Command Interface) web service, and the messages are handled in a manner similar to RCI (Remote Command Interface) messages.

To send an SMS message using the Remote Manager SCI web service, specify the message as a child of the of the SCI <send_message> operation using the tag as a child element. Remote Manager creates a job for each web services request, and the job can be synchronous or asynchronous. You can retrieve Remote Manager job results the same way as you retrieve results for RCI jobs.

Send message options and SMS messages

Use the following <send_message> options to control how Remote Manager handles SMS message requests:

  • synchTimeout = “xxx” Behavior is identical to existing SCI requests.
  • reply = “all | errors | none” Controls whether a reply is sent by the device back to the server for a command. Using this option, you can control the number of Remote Manager SMS messages directly sent. The default is none. Note that all and errors work the same way for all SCI requests, including SMS message requests.
  • cache = “true | false | only” Remote Manager does not currently service SMS requests from the cache. Therefore, specifying only returns an error. In addition, true or false result in the request being sent to the device. The default is false.

© 2023 Digi International Inc. All rights reserved.

SMS Command XML Child Elements

The XML child elements for an SMS command.

Command Description
ping Ping the device via SMS to determine whether device can receive SMS messages. No parameters.
provision Configure the device with the Remote Manager server telephone number and optionally the service ID. The restrict sender flag must be off in the device for this command. No parameters.
raw Send raw SMS message from the device with no modification from Remote Manager. This is useful in cases when customers wish to use every byte of the SMS message (Remote Manager protocol takes approximately 5 bytes per message of overhead) or when using a device that doesn’t have Remote Manager protocol support but does have SMS support. SMS raw messages can be a maximum of 160 characters. The supported characters are dependent on your carrier, but are character only (not binary). They are not guaranteed to be delivered, may be delivered more than once, and are not guaranteed to be correct (they are subject to corruption).
reboot Reboot the device immediately. No parameters.
request_connect Request a Remote Manager data connection. If a connection has already been made, forces a reconnect of the management session. No parameters.
command Send a command. Options include: maxResponseSize=’’’’’ Set maximum size of the response. If the response is larger than the maxResponseSize, the response is truncated. The value is the number of SMS messages that make up the response. This is an optional parameter. If not specified, the size of the response is determined by the device.
user_msg Send a message to a registered listener in python. This command is similar to the RCI do_command custom target command. path=’’’’’ Send requests to a specific listener. If this optional parameter is omitted, the message is delivered to the listener on the device that is registered to the null path.
dia Send a DIA command to the running DIA instance. The format of this request is documented in the DIA SMS presentation documentation.
Optional attribute for the above commands format=“base64|text” Set the encoding of the request to Base64 or text: use base64 for Base64 encoding; use text for plain text. The default format is text. All subcommands (cli, user_msg, and so on) support the format=“base64|text” attribute. If the server detects characters that will cause the response to be invalid XML, it encodes the response in Base64 and indicates this with the format=“base64” attribute. That is, even if a request uses format=“text”, the reply may have format=“base64” set.

© 2023 Digi International Inc. All rights reserved.

Using SMS Command to Send a Request Connect

You can use Remote Manager to send an SMS request connect message to a Remote Manager-registered device to cause the device to connect back to the server using the device-initiated connection method over TCP/IP. Once the device is connected, you can initiate web services requests and Remote Manager UI actions for the device. In this way, devices do not need to maintain a Remote Manager connection at all times. Instead, connections can be established dynamically as needed.

© 2023 Digi International Inc. All rights reserved.

Provision Sms

To use SMS with a device, Remote Manager needs the telephone number of the device. Typically, when a registered device connects for the first time, the telephone number is read from the device and automatically provisioned. However, there are cases where auto-provisioning does not occur. For example, a device connects for the first time and cellular is not yet configured or a device is provisioned before connecting to Remote Manager. In these cases, you must manually provision the device with the telephone number.

To provision the telephone number for a Remote Manager-registered device, the telephone number must be added to an entry in the NetworkInterface that represents a SIM installed on the device. To provision a device, follow these general steps:

Step1: Retrieve the telephone number from a device

Step 2: Find the NetworkInterface record for the device

Step 3: Update NetworkInterface record

Step 4: Configure phone number without an existing NetworkInterface record

© 2023 Digi International Inc. All rights reserved.

Step 1: Retrieve the Phone Number from a Device

You can retrieve the telephone number of the device using the following RCI request. The sample response contains the telephone number of the device (phnum):

<rci_request version="1.1">
    <query_state>
       <mobile_stats />
    </query_state>
</rci_request>
<rci_reply version="1.1">
    <query_state>
       <mobile_stats>
          <mobile_version>1.1</mobile_version>
          <modemtype>GSM</modemtype>
          <rssi>-42</rssi>
          <quality max="5">5</quality>
          <g3rssi>0</g3rssi>
          <g3quality max="5">0</g3quality>
          <rstat code="1">Registered (Home Network)</rstat>
          <cid>34016</cid>
          <lac>32004</lac>
          <imsi>310410316937398</imsi>
          <iccid>89014104243169373988</iccid>
          <phnum>19522213895</phnum>    <!-- phone number of the device -->
          <manuf>SIEMENS</manuf>
          <model>TC63</model>
          <sn>355633002498656</sn>
          <rev>REVISION 02.000</rev>
          <varinfo index="1">
             <desc>Network Name</desc>
             <data>N/A</data>
          </varinfo>
          <varinfo index="2">
             <desc>(E)GPRS Status</desc>
             <data>GPRS Attached</data>
          </varinfo>
          <varinfo index="3">
             <desc>Current Band</desc>
             <data>850 MHz, 1900 MHz</data>
          </varinfo>
          <varinfo index="4">
             <desc>User Band Selection</desc>
             <data>Automatic</data>
          </varinfo>
          <varinfo index="5">
             <desc>Mobile Channel</desc>
             <data>235</data>
          </varinfo>
          <varinfo index="6">
             <desc>Mobile Country Code</desc>
             <data>310</data>
          </varinfo>
          <varinfo index="7">
             <desc>Mobile Network Code</desc>
             <data>410</data>
          </varinfo>
          <varinfo index="8">
             <desc>User Carrier Selection</desc>
             <data>Automatic</data>
          </varinfo>
          <varinfo index="9">
             <desc>PLMN Color</desc>
             <data>3</data>
          </varinfo>
          <varinfo index="10">
             <desc>Base Station Color</desc>
             96
             <data>5</data>
          </varinfo>
          <varinfo index="11">
             <desc>Max Power RACH</desc>
             <data>0</data>
          </varinfo>
          <varinfo index="12">
             <desc>Min Rx Level</desc>
             <data>-111</data>
          </varinfo>
          <varinfo index="13">
             <desc>Base Coefficient</desc>
             <data>68</data>
          </varinfo>
          <varinfo index="14">
             <desc>SIM Status</desc>
             <data>5: SIM Initialization Complete</data>
          </varinfo>
          <varinfo index="15">
             <desc>SIM PIN Status</desc>
             <data>Ready</data>
          </varinfo>
          <stats_index>5</stats_index>
          <multi_sim_enabled>no</multi_sim_enabled>
       </mobile_stats>
    </query_state>
</rci_reply>

© 2023 Digi International Inc. All rights reserved.

Step 2: find the NetworkInterface Record for the Device

The information within this step only applies to configurations that have an existing entry in NetworkInterface record to update. If you perform the GET below and determine that your configuration does not have a niId value, skip this step and proceed to step 4.

To find the NetworkInterface record to update for your Remote Manager-registered device, perform a GET similar to the following:

GET /ws/DeviceInterface/?condition=devConnectwareId='00000000-00000000-00409DFF-FF2EB94D'

Replace ‘00000000-00000000-00409DFF-FF2EB94D’ with the device ID of your device.

Here is a sample reply:

<result>
   <resultTotalRows>3</resultTotalRows>
   <requestedStartRow>0</requestedStartRow>
   <resultSize>1</resultSize>
   <requestedSize>1000</requestedSize>
   <remainingSize>0</remainingSize>
   <DeviceInterface>
      <id>
         <devId>6</devId>
         <devVersion>0</devVersion>
         <niId>26</niId>
         <niVersion>0</niVersion>
      </id>
      <devRecordStartDate>2011-01-13T18:22:00Z</devRecordStartDate>
      <devMac>00:40:9D:2E:B9:4D</devMac>
      <devCellularModemId>355633002498656</devCellularModemId>
      <devConnectwareId>00000000-00000000-00409DFF-FF2EB94D</devConnectwareId>
      <cstId>10</cstId>
      <grpId>10</grpId>
      <devEffectiveStartDate>2011-01-05T21:37:00Z</devEffectiveStartDate>
      <devTerminated>false</devTerminated>
      <niRecordStartDate>2011-02-15T21:45:00Z</niRecordStartDate>
      <niInterfaceType>0</niInterfaceType>
      <niEffectiveStartDate>2011-02-15T20:25:00Z</niEffectiveStartDate>
      <niTerminated>false</niTerminated>
      <niPhone>N/A</niPhone>
      <niActivePhone>false</niActivePhone>
      <niIdigiPhone>12029823370</niIdigiPhone>
   </DeviceInterface>
</result>

Within the result, find the nild of the NetworkInterface record to be updated. In the above example, the nild is 26. Use the niId to retrieve the NetworkInterface record:

/ws/NetworkInterface/26/0 (replace with your device's niId, 0 means most recent version) 
<result>
   <resultTotalRows>1</resultTotalRows>
   <requestedStartRow>0</requestedStartRow>
   <resultSize>1</resultSize>
   <requestedSize>1000</requestedSize>
   <remainingSize>0</remainingSize>
   <NetworkInterface>
      <id>
         <niId>26</niId>
         <niVersion>0</niVersion>
      </id>
      <niRecordStartDate>2011-02-15T21:45:00Z</niRecordStartDate>
      <devId>6</devId>
      <devVersion>0</devVersion>
      <niInterfaceType>0</niInterfaceType>
      <cstId>10</cstId>
      <grpId>10</grpId>
      <niEffectiveStartDate>2011-02-15T20:25:00Z</niEffectiveStartDate>
      <niTerminated>false</niTerminated>
      <niPhone>N/A</niPhone>
      <niPhoneCarrier>3</niPhoneCarrier>
      <niActivePhone>false</niActivePhone>
      <niIdigiPhone>12029823370</niIdigiPhone>
      <niIdigiServiceId></niIdigiServiceId>
   </NetworkInterface>
</result>

© 2023 Digi International Inc. All rights reserved.

Step 3: Update Networkinterface Record

To update the NetworkInterface record with the device Modem ID, copy the contents of from the GET above. Update the niPhone tag with the phone number you discovered in Step1: Retrieve the telephone number from a device (replace N/A with your device phone number). Change the status of niActivePhone and then remove the id tag.

The values added below are: niActivePhone: true (to indicate this is the active Remote Manager SMS record. There can be more than one NetworkInterface record per device. Only one can have niActivePhone true). niPhone: The phone number of the SIM (discovered in step 1).

PUT /ws/NetworkInterface/26

Payload:

<?xml version="1.0" encoding="UTF-8"?>
<NetworkInterface>
   <niRecordStartDate>2011-02-15T21:45:00Z</niRecordStartDate>
   <devId>6</devId>
   <devVersion>0</devVersion>
   <niInterfaceType>0</niInterfaceType>
   <cstId>10</cstId>
   <grpId>10</grpId>
   <niEffectiveStartDate>2011-02-15T20:25:00Z</niEffectiveStartDate>
   <niTerminated>false</niTerminated>
   <niPhone>19522213895</niPhone>
   <niActivePhone>true</niActivePhone>
</NetworkInterface>

© 2023 Digi International Inc. All rights reserved.

Step 4: Configure Phone Number without an Existing NetworkInterface Record

The information within this step only applies to configurations that do not have an existing entry in NetworkInterface to update (as described in step 2).

Find the the devId for your Remote Manager-registered device

Perform a GET on /ws/DeviceCore?condition=devConnectwareId=‘00000000-00000000-00409DFF-FF4A3946’ (replace with your device ID).

<?xml version="1.0" encoding="UTF-8"?>
<result>
   <resultTotalRows>1</resultTotalRows>
   <requestedStartRow>0</requestedStartRow>
   <resultSize>1</resultSize>
   <requestedSize>1000</requestedSize>
   <remainingSize>0</remainingSize>
   <DeviceCore>
      <id>
         <devId>1224</devId>  <!-- devId of the device -->
         <devVersion>28</devVersion>
      </id>
      <devRecordStartDate>2011-12-20T20:34:00.000Z</devRecordStartDate>
      <devMac>00:40:9D:4A:39:46</devMac>
      <devCellularModemId>357975020409993</devCellularModemId>
      <devConnectwareId>00000000-00000000-00409DFF-FF4A3946</devConnectwareId>
      <cstId>27</cstId>
      <grpId>27</grpId>
      <devEffectiveStartDate>2011-12-20T20:23:00.000Z</devEffectiveStartDate>
      <devTerminated>false</devTerminated>
      <dvVendorId>4261412864</dvVendorId>
      <dpDeviceType>ConnectPort X4</dpDeviceType>
      <dpFirmwareLevel>34406404</dpFirmwareLevel>
      <dpFirmwareLevelDesc>2.13.0.4</dpFirmwareLevelDesc>
      <dpRestrictedStatus>0</dpRestrictedStatus>
      <dpLastKnownIp>10.8.16.16</dpLastKnownIp>
      <dpGlobalIp>66.77.174.126</dpGlobalIp>
      <dpConnectionStatus>1</dpConnectionStatus>
      <dpLastConnectTime>2011-12-20T20:24:00.000Z</dpLastConnectTime>
      <dpContact />
      <dpDescription />
      <dpLocation />
      <dpPanId>0xd367</dpPanId>
      <xpExtAddr>00:13:A2:00:40:66:A1:B2</xpExtAddr>
      <dpServerId>ClientID[3]</dpServerId>
      <dpZigbeeCapabilities>383</dpZigbeeCapabilities>
   </DeviceCore>
</result>

Update the devId, niInterfaceType, and niPhone tags

  • Update the devId tag below with the devId number discovered in step a, devId is 1224 in the above example. Replace the devId number in the example below with your device’s devId number.
  • Ensure the the niInterfaceType value is set to 0.
  • Update the niPhone tag below with the phone number (found within the phnum tag) discovered in step 1. Replace the phone number displayed in the example below with your device’s phone number.

The values added below are: devId: The devID number of the device. niPhone: The phone number of the device (discovered in step 1). niInterfaceType: The interface type of the device (0 means most recent version).

POST /ws/NetworkInterface

<NetworkInterface>
   <devId>1224</devId>
   <niInterfaceType>0</niInterfaceType>
   <niTerminated>false</niTerminated>
   <niPhone>19522213895</niPhone>
</NetworkInterface>

Configure Device to Receive SMS Commands

The following example RCI request will configure a device to enable SMS, configure SMS, disable client initiated Remote Manager connections, and configure paged Remote Manager connections. See below for an explanation of the parameters.

RCI request:

<rci_request version="1.1">
   <set_setting>
      <smscell>
         <state>on</state>
      </smscell>
      <idigisms>
         <state>on</state>
         <restrict_sender>on</restrict_sender>
         <phnum>12029823370</phnum>
         <service_identifier></service_identifier>
      </idigisms>
      <mgmtconnection index="1">
         <connectionType>client</connectionType>
         <connectionEnabled>off</connectionEnabled>
      </mgmtconnection>
      <mgmtconnection index="4">
         <connectionType>paged</connectionType>
         <connectionEnabled>on</connectionEnabled>
         <pagedConnectionOverrideEnabled>on</pagedConnectionOverrideEnabled>
         <serverArray index="1">
            <serverAddress>en://login.remotemanager.digi.com</serverAddress>
         </serverArray>
      </mgmtconnection>
      <mgmtglobal>
         <connIdleTimeout>2220</connIdleTimeout>
      </mgmtglobal>
      <mgmtnetwork index="1">
         <networkType>modemPPP</networkType>
         <connectMethod>mt</connectMethod>
         <mtRxKeepAlive>3000</mtRxKeepAlive>
         <mtTxKeepAlive>3000</mtTxKeepAlive>
         <mtWaitCount>3</mtWaitCount>
      </mgmtnetwork>
   </set_setting>
</rci_request>

RCI for SMS

RCI group: idigisms

Field Options Description
state on, off Remote Manager SMS support enabled or disabled. If off, SMS messages will not be processed.
phnum number The phone number that the device will use to send messages to Remote Manager. This needs to be obtained from Digi (each cluster has its own phone number).
service_identifier string An ID that when combined with the phone number forms the complete address of Remote Manager server. This needs to be obtained from Digi (each cluster has its own phone number).
restrict_sender on, off If on, only Remote Manager SMS messages originating from “phnum” and with the service ID “service_identifier” will be honored as Remote Manager SMS messages.

RCI group: smscell

Field Options Description
state on, off Enables basic SMS support for a device. This needs to be on for Remote Manager SMS to communicate.

RCI group: mgmtconnection index = “1” (client initiated Remote Manager connections)

Field Options Description
connectionEnabled on, off Enables client initiated connections. When off, the device will not attempt to keep a Remote Manager connection open.

RCI group: mgmtconnection index = “4” (paged - i.e. temporary - - Remote Manager connections)

Field Options Description
connectionEnabled on, off Enables temporary connections. A connection request results in a paged Remote Manager connection being established to the server. If this parameter is off, a connection will not be made.
pagedConnectionOverrideEnabled on, off When on, paged connections will take priority over client initiated requests so that connection requests always result in a new connection. Set to on.
serverArrayindex=“1” serverAddress url Send to the dns name of Remote Manager server in the form: en://<dns-name>.

RCI group: mgmtglobal

Field Options Description
connIdleTimeout Timeout in seconds Connection is dropped after this number of seconds of inactivity. Any traffic on the connection, including keep-alive traffic, count as non-idle for purposes of this timer.

RCI group: mgmtnetwork index = “1 “ (cellular Remote Manager connection configuration)

Field Options Description
mtRxKeepAlive Timeout in seconds Receive keep-alive timeout. Must be higher than connIdleTimeout or connIdleTimeout is defeated.
mtTxKeepAlive Timeout in seconds Transmit keep-alive timeout. Must be higher than connIdleTimeout or connIdleTimeout is defeated.
mtWaitCount Number Number of missed keep-alives before connection is considered dropped. Shown for completeness only; is not directly related to connection request behavior.

Send Remote Manager SMS Request Connect

To send a connect request to a device via SMS, POST the following SCI request to /ws/sci:

<sci_request version="1.0">
   <send_message synchronous="true" syncTimeout="60" reply="all">
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
      <sms>
         <request_connect />
      </sms>
   </send_message>
</sci_request>

Details: SCI is used to send SMS requests to Remote Manager-registered devices. The behavior is very similar to RCI processing from a user’s perspective.

As in RCI, web services requests result in jobs being created in Remote Manager. These jobs can be synchronous or asynchronous and job results are retrieved the same way they are for RCI jobs.

The <send_message> command will be used, <send_message> options have the following effect with SMS:

  • synchronous= “true|false”

“true " results in a synchronous request; “false” for asynchronous.

  • syncTimeout= “x”

Time in seconds that the operation is given to complete. Valid for synchronous jobs only.

  • reply= “all|errors|none”

“all " means return a reply SMS, “errors " means request a reply but the result of the command will only show errors, “none " means do not request a response.

This controls whether an SMS reply is sent by the device back to the server for a command. This is primarily intended to allow the SMS user to directly control the number of Remote Manager SMS messages being sent, since they are charged for each one. Note, this option is honored even when it results in less than ideal behavior. For instance, a no-reply ping is useless.

SMS requests are specified by the tag <sms> as a child element of <send_message>.

<request_connect>, requests a device to connect using EDP (reconnects if already connected).

  • request_connect takes no parameters

Wait for Device to Connect

The connection status of any Remote Manager-registered device may be found by performing a GET on /ws/DeviceCore.

The result has an entry for each Remote Manager-registered device. In that entry, the element dpConnectionStatus is 0 if the device is disconnected and 1 if connected:

<dpConnectionStatus>0</dpConnectionStatus>

A GET on /ws/DeviceCore returns a list of all Remote Manager-registered devices. To retrieve status for a single device, issue a GET on /ws/DeviceCore/{id} where the id is the id associated with a particular device.

Send a Disconnect

Once work is complete to a device, a web services client may optionally disconnect the registered device from Remote Manager:

POST /ws/sci

<sci_request version="1.0">
   <disconnect>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
   </disconnect>
</sci_request>

© 2023 Digi International Inc. All rights reserved.

SM/UDP

The SM/UDP (Short Message/User Datagram Protocol) feature allows devices to leverage the very small data footprint of Remote Manager SM protocol (currently used for SMS) over UDP. However, it is important to note that SM/UDP requests vary greatly from SMS as SM/UDP requests are not immediately sent to a device. Instead, requests of this type are queued as devices may not be publicly addressable. This creates a way for devices to interact with Remote Manager in a way that is efficient from a data perspective and does not require a persistent connection. This feature enables devices with constrained data plans to keep data traffic to an absolute minimum by only occasionally sending data readings to Remote Manager.

Initially, no requests are queued in the server. A device will send a request to the server and the server will process the request, sending a reply to the device only if the device specified that one should be sent in the request.

At some point an SM/UDP request may be targeted for the device. This request can be sent via a Web Services request, using the options within the Actions Menu of the Devices page, or as the result of an automation. When a device sends an SM/UDP request (known as a datagram) to Remote Manager, Remote Manager will process the request and queue it for delivery to the device. The next time the device sends a message (regardless of whether a reply was specified), Remote Manager will check for queued messages and send them down to the device.

For example, if you send the SM/UDP Reboot request to your device, the device will not reboot immediately. Instead, the SM/UDP Reboot request will be queued for the device. The next time an SM/UDP request is sent to the device, Remote Manager will check for queued messages and send the queued SM/UDP Reboot request to the device instructing it to reboot itself. Once a request is queued for a device, it may remain queued for multiple days. Once the request is actually sent to a device, it typically has a timeout of 60 seconds (plus a small window in some circumstances).

© 2023 Digi International Inc. All rights reserved.

Sending and Receiving SM/UDP messages

Remote Manager sends SM/UDP requests to Remote Manager-registered devices via SCI. SM/UDP requests are handled in a similar manner to RCI messages. They are specified as a child of the <send_message> command. As in RCI, web services requests cause Remote Manager to create jobs. These jobs can be synchronous or asynchronous and job results are retrieved the same way they are for RCI jobs.

It is suggested that SM/UDP requests be done asynchronously since requests of this type require the device to send a message before a server message can be sent, and therefore can potentially take a long time to complete. Synchronous requests are acceptable in situations where the device is frequently sending messages to the server.

send_message options have the following effect with SM/UDP:

  • synchTimeout=“xxx” Behavior is identical to existing SCI requests.

  • reply=“all|errors|none” Controls whether a reply is sent by the device back to the server for a command. This is primarily intended to allow you to control the number of SM/UDP messages being sent directly. The default is “none”. Note that “all” and “errors” continue to work as they do currently in other SCI requests.

  • cache=“true|false|only” Remote Manager does not currently service SM/UDP requests from the cache. Therefore, specifying “only” will return an error. In addition, “true” or “false” will result in the request being sent to the device. The default is “false”.

SM/UDP requests are specified by the tag <sm_udp> as a child element of <send_message>.

© 2023 Digi International Inc. All rights reserved.

SM/UDP Command XML Child Elements

The following xml elements can be children of an SM/UDP command

Command Description
ping Request to determine whether device is able to receive SM/UDP requests - No parameters
reboot Reboot device immediately - No parameters
request_connect Request a Remote Manager data connection. If a connection has already been made, this will force a reconnect of the management session. - No parameters
command Command line interface request maxResponseSize=’’’’’ Set maximum size of the response. If the response is larger than this value, it will be truncated. The value is the number of SM/UDP messages into which the response is broken. This is an optional parameter. If not specified, the size of the response is determined by the device.
user_msg Send a message to a registered listener in python. This command is similar to the RCI do_command custom target command. path=’’’’’ Send requests to a specific listener. If this optional command is omitted, the message is delivered to the listener on the device that is registered to the null path.
Optional attribute for the above commands format=“base64|text” Set the encoding of the request to Base64 or text. Using “base64” indicates Base64 encoding, and “text” means the request is in plain text. The default for format is text. All subcommands (cli, user_msg, etc.) support the format=“base64|text” attribute.Note If the server detects characters that will cause the response to be invalid XML, it will encode the response in Base64 and indicate this with the format=“base64” attribute. That is, even if a request uses format=“text”, the reply may have format=“base64” set.

© 2023 Digi International Inc. All rights reserved.

SM/UDP Request Connect

Remote Manager can be used to send a SM/UDP “request connect” message to a Remote Manager-registered device which will cause it to connect back to the server using the device-initiated connection method over TCP/IP. Once it is connected, web services requests and UI actions can be made to the device. With this support, devices no longer need to maintain a Remote Manager connection at all times. Connections instead can be established dynamically.

This section describes the web services actions to accomplish this. All of these actions can be performed in the Remote Manager UI as well.

Configure Device to Receive SM/UDP Commands

The following example will configure a Remote Manager-registered device to enable SM/UDP.

POST to /ws/DeviceCore to provision a device with SM/UDP enabled.

<DeviceCore> 
  <devMac>00:40:9D:00:00:00</devMac> 
  <dpUdpSmEnabled>true</dpUdpSmEnabled>
</DeviceCore>

The device will be added to your account and configured to enable SM/UDP.

If you want to disable SM/UDP for a device, use the following example.

PUT to /ws/DeviceCore to update the device and disable SM/UDP.

<DeviceCore> 
  <devConnectwareId>00000000-00000000-00409DFF-FF000000</devConnectwareId>
  <dpUdpSmEnabled>false</dpUdpSmEnabled>
</DeviceCore>

After sending this request the device will no longer be configured for SM/UDP.

Message Compression

<dpSmCompressionAvailable>true/false</dpSmCompressionAvailable>

This configures the server to allow compression to be used for SM requests. Defaults to false, but can be inferred by a device sending a compressed request.

Pack Command

<dpSmPackAvailable>true/false</dpSmPackAvailable>

This configures the server to allow pack commands to be sent to the device. The pack command allows multiple SM commands to be merged and sent in a single datagram to reduce data usage and overhead. Defaults to false, but can be inferred by a device sending a pack command.

Battery Operated Mode

<dpSmBatteryOperated>true/false</dpSmBatteryOperated>

This configures the server to send requests to the device in battery operated mode. Battery operated mode can be used for devices that should only recieve a single reply to a request sent to the server, where it was indicated that the device needed a response. This tells the device that it can immediately shut down its network connection to conserve power. This mode implies that the device also supports the pack command. Unless the device requires this mode, it may add unnecessary limitations. Defaults to false.

Send SM/UDP Request Connect

To send a connect request to a device via SM/UDP, POST the following SCI request to /ws/sci:

<sci_request version="1.0"> 
  <!-- It is suggested SM/UDP requests be done asynchronously as they can
  take a while and requests done synchronously may time out before the
  response has been received.  See the Check Request Status Example
  for information on retrieving status and results. -->
  <send_message synchronous="false"> 
    <targets> 
      <device id="00000000-00000000-00000000-00000000"/> 
    </targets>
    <sm_udp>
      <request_connect/>
    </sm_udp>
  </send_message>
</sci_request>

Details: SCI is used to send SM/UDP requests to Remote Manager-registered devices. The behavior is very similar to RCI processing.

As in RCI, web services requests result in jobs being created in Remote Manager. These jobs can be synchronous or asynchronous and job results are retrieved the same way they are for RCI jobs.

Digi recommends you execute SM/UDP requests asynchronously. Synchronous requests may time out before the response has been received.

The <send_message> command will be used, <send_message> options have the following effect with SM/UDP:

  • synchronous=“true|false”

“true” results in a synchronous request; “false” for asynchronous.

SM/UDP requests are specified by the tag <sm_udp> as a child element of <send_message>.

<request_connect>, requests a device to connect using EDP (reconnects if already connected).

  • request_connect takes no parameters

Wait for Device to Connect

The connection status of any Remote Manager-registered device may be found by performing a GET on /ws/DeviceCore.

The result has an entry for each Device Cloud-registered device. In that entry, the element dpConnectionStatus is 0 if the device is disconnected and 1 if connected:

<dpConnectionStatus>0</dpConnectionStatus>

Note: A GET on /ws/DeviceCore returns a list of all Device Cloud-registered devices. To retrieve status for a single device, issue a GET on /ws/DeviceCore/{id} where id is the id associated with a particular device.

Send a Disconnect

Once work is complete to a device, a web services client may optionally disconnect the registered device from Device Cloud:

POST /ws/sci

<sci_request version="1.0">
   <disconnect>
      <targets>
         <device id="00000000-00000000-00000000-00000000" />
      </targets>
   </disconnect>
</sci_request>