Tutorial: Adding data from physical devices

Complete the steps to add devices to the IoT tool. Use REST APIs to send events from these devices to the IoT tool. Later, you create summary and device dashboards to monitor the device data.

About this task

In this tutorial, you are creating a robot device type and corresponding robot devices by using the IoT tool.

You do not need to connect physical devices to the IoT tool. Instead, you can use the REST API to send device events to the IoT tool.

The following Messaging API endpoint is used to send device events:

POST /device/types/{typeId}/devices/{deviceId}/events/{eventName}

A third-party application, such as Postman, can be used to make the REST API calls. For more information, see Postman.

The device type that you create is available as a device type in Maximo® Monitor. You define a metric that uses a built-in function to calculate the metric.

Step 1: Add a robot device type

Before you can register and connect your devices to the IoT tool, you must create a device type.

  1. From the IoT tool, select Device Types and then click Add Device Type.
  2. Assign a name to the device type and click Next.
  3. Click Finish.

Step 2: Add five robot devices

  1. Select Connect and then click Add a device.
  2. Find the robot device type.
  3. Assign a device ID to the device and click Next.
  4. Add dimensions to the device. For provider, assign either intech or martech. For color, assign either red or yellow. The following code is an example.
{
  "provider": "intech",
  "color": "red"
}
  1. Assign an authentication token to the device. If you don't assign one, a token is autogenerated for you.
  2. Write down the unique device ID and token that you configure for the device. These parameters are used to reference your device.
  3. Click Save and finish.
  4. Repeat these steps for four more robot devices.

Step 3: Connect the devices

Connect the five devices to the IoT tool, and send some events to see data flow into the IoT tool.

Before you send data, go to the Recent events section of your device page to monitor recent events as they arrive.

  1. Open Postman.
  2. Click New > Request.
  3. Specify a name for the request.
  4. In the request field, select POST.
  5. Enter the API endpoint URL, for example,
    https://{orgId}.messaging.{base_url}/api/v0002/device/types/{typeId}/devices/{deviceId}/events/{eventName} Where {orgId} is the unique six-character organization ID that was generated when you registered the IoT tool.
  6. Select the Authorization tab.
    1. Set Type to Basic Auth.
    2. Set Username to use-token-auth.
    3. Use the token that you created when you added the device.
  7. Select the Headers tab and set Content-Type to application/json.
  8. Select the Body tab and add the following JSON payload:
{
    "load": 355,
    "torque": 8.5,
    "speed": 6.7,
    "acc": 5,
    "travel_time": 4.6
}
  1. Repeat the POST request for the four other devices. Vary the metric values slightly each time.

Keep your Postman session open. You will send some more events later after you create some sample dashboards.

Step 4: Explore device metrics for your robots

Verify that a corresponding device type and devices are created in Maximo Monitor.

  1. In Maximo Monitor, on the Monitor page, on the Devices tab, find your device type. The device type name is the same as the device type name that you configured in the IoT tool.
  2. Select the Data tab and verify that you can see data for the devices. The data lake contains historical data and is populated as your devices contribute data. A time lag occurs between when you connect a device for the first time and when the data starts appearing.

Step 5: Create device type metrics

  1. In Maximo Monitor, on the Monitor page, on the Devices tab, click your device type and then click Set up device type.
  2. On the Data tab, create a batch data metric.
  3. Select the PythonExpression function.
  4. Set the scope and click Next.
  5. Enter the following pandas expression:
    df["torque"]*df["load"]
  6. Click Next.
  7. Give the output metric the name: work_performed
  8. Click Create. Wait a couple of minutes for the scheduled calculations to run and then return to the Data tab.

Step 6: Add an alert

Add an alert to your device type.

  1. inMaximo Monitor, on the Monitor page, on the Devices tab, select your device type and click Set up device type.
  2. On the Data tab, create a batch data metric.
  3. Select the AlertHighValue function.
  4. Set the scope and then click Next.
  5. Select work_performed in the input_item drop-down list.
  6. In the upper_threshold field, enter 1000.
  7. Click Next.
  8. Assign the name work_performed_too_high to the alert.
  9. Click Create.
  10. Wait for the pipeline to generate data.