It can take up to a minute before a connection between a mobile or desktop device and the ADI OtoSense™ Smart Motor Sensor is established.

To determine whether this connection has been successfully established, you can use HTTP GET requests to check for the sensor’s name and/or firmware and hardware version numbers. If the sensor returns these values, the connection has been established.

Figure 3: An example of an initial connection flow

Getting the sensor name

The sensor name will be used later to identify the sensor in the ADI OtoSense™ cloud.

Protocol: HTTP
Host: 10.123.45.1
Method: GET
Path: /__SL_G_DNP
Response Content Type: text/plain
Sample Response:
SMS0000S111A

Warning: The prefix ‘SMS’ should be removed from the response. This prefix is added to enable users to more easily identify and find the SMS AP SSID.

Getting the sensor firmware and hardware version numbers (optional)

This is an optional step. Retrieves the firmware and hardware version.

Protocol: HTTP
Host: 10.123.45.1
Method: GET
Path: /api/1/host/version/1/sms_version
Response Content Type: application/json
Sample Response:

{
  "Firmware Version": "1.1.0",
  "Hardware Version": "1.0"
}

Getting the sensor certificate

The mobile or desktop application should read the ADI OtoSense™ Smart Motor Sensor certificate via an HTTP GET request.
The certificate is found in the `certInfo` property and is required to provision the SMS in the cloud.

Protocol: HTTP
Host: 10.123.45.1
Method: GET
Path: /api/1/host/certs/1/clientcert
Response Content Type: application/json
Sample Response:

{
	"certType": "clientcert.crt",
	"certInfo": "-----BEGIN%02CERTIFICATE-----\nbase64encodeddata .. base64encodeddata=\n-----END%02CERTIFICATE-----\n-----BEGIN%02CERTIFICATE-----\nbase64encodeddata .. base64encodeddata=\n-----END%02CERTIFICATE-----"
}

Warning: The certInfo string will contain instances of the string ‘%02’. These are artifacts of the transfer and should be removed from the response and replaced with a space (‘ ‘).

Setting the IoT endpoint

The Smart Motor Sensor will communicate with the cloud using MQTT packets that are sent and received via the IoT endpoint. The IoT Endpoint needs to be added to the sensor’s configuration file. This can be accomplished via an HTTP POST request.

*Protocol:** HTTP
Host: 10.123.45.1
Method: POST
Path: /api/1/host/cloud/1/config
Request Content Type: application/json
Request Schema:

Parameter Description
url The IoT Endpoint [see Before you begin for details]

Sample Request:
bc. { “url”: “xxxxxxxxxxxx-xxx.iot.xx-xxxx-x.amazonaws.com”
}