AWS IoT Events
Developer Guide

Send Inputs to Test the Detector Model

There are several ways to receive telemetry data in AWS IoT Events (see Using AWS IoT Events with Other Services). This topic shows you how to create an AWS IoT rule in the AWS IoT Core console that forwards messages as inputs to your AWS IoT Events detector. You can use the AWS IoT Core console's MQTT client to send test messages. You can use this method to get telemetry data into AWS IoT Events when your devices are able to send MQTT messages using the AWS IoT message broker.

To send inputs to test the detector model

  1. Open the AWS IoT core console. In the navigation pane, choose Act.

  2. On the Rules page, choose Create.

  3. On the Create a rule page, enter a Name and Description.

  4. In the Rule query statement, enter the following.

    SELECT *, topic(2) as motorid FROM 'motors/+/status'
  5. In Set one or more actions, choose Add action.

  6. On the Select an action page, select Send a message to an AWS IoT Events Input and choose Configure action.

  7. On the Configure action page, do the following:

    1. For Input name, enter the name that you created in the previous section.

    2. For Role, choose Create Role and in the Create a new role window, enter a Name and choose Create role. This creates a role with permission to forward messages to AWS IoT Events.

    3. Back on the Configure action page, choose Add action.

  8. On the Create a rule page, choose Create rule.

  9. On the Rules page, in the navigation pane, choose Test.

  10. On the MQTT client page, choose Publish to a topic.

  11. In the Publish section, enter the topic, enter the following payload in the editor, and choose Publish.

    { "sensorData": { "pressure": 23, "temperature": 47 } }
  12. For Publish, keep the topic the same, but change the "pressure" in the payload to a value greater than the threshold value that you specified in the detector model (for example, 85).

  13. Choose Publish.

The detector instance that you created generates and sends you an SNS message. Continue to send messages with pressure readings above or below the pressure threshold (70 for this example) to see the detector in operation.

In this example, you must send three messages with pressure readings below the threshold to transition back to the Normal state and receive an SNS message that indicates the overpressure condition has cleared. Once back in the Normal state, one message with a pressure reading above the limit causes the detector to enter the Dangerous state and send an SNS message indicating that condition.

Now that you created a simple input and detector model, try the following.