2 - Configure rules and actions for your device in Azure IoT Central

This tutorial shows you, as a builder, how to configure telemetry-based rules and actions in your Microsoft Azure IoT Central application.

In this tutorial, you create a rule that sends an email when the temperature in a connected air conditioner device exceeds 90° F.

In this tutorial, you learn how to:

  • Create a telemetry-based rule
  • Add an action

Prerequisites

Before you begin, you should complete the Define a new device type in your application tutorial to create the Connected Air Conditioner device template to work with.

Create a telemetry-based rule

  1. To add a new telemetry-based rule to your application, in the left navigation menu, choose Device Explorer:

    Device Explorer page

    You see the Connected Air Conditioner (1.0.0) device template and the Connected Air Conditioner-1 device you created in the previous tutorial.

  2. To start customizing your connected air conditioner device, choose the device you created in the previous tutorial:

    Connected air conditioner page

  3. To start adding a rule in the Rules view, choose Rules:

    Rules view

  4. In this tutorial, you add a threshold-based telemetry rule. To start creating a threshold-based rule, choose New Rule, then Telemetry.

  5. To define your rule, use the information in the following table:

    Setting Value
    Name Air conditioner temperature
    Enable rule On
    Condition Temperature is greater than 90

    Temperature rule condition

Add an action

When you define a rule, you also define an action to run when the rule conditions are met. In this tutorial, you add an action to send an email as a notification that the rule triggered.

  1. To add an Action, scroll down on the Configure Telemetry Rule panel and choose the + next to Actions, then choose Email:

    Temperature rule action

  2. To define your action, use the information in the following table:

    Setting Value
    To Your email address
    Notes Temperature in air conditioner exceeded threshold.

    Note

    To receive an email notification, the email address must be a user ID in the application, and that user must have signed in to the application at least once.

    Application Builder Temperature action

  3. Choose Save. Your rule is listed on the Rules page:

    Application Builder rules

Test the rule

Shortly after you save the rule, it becomes live. When the conditions defined in the rule are met, your application sends a message to the email address you specified in the action.

Email action

Next steps

In this tutorial, you learned how to:

  • Create a telemetry-based rule
  • Add an action

Now that you have defined a threshold-based rule the suggested next step is to Customize the operator's views.

To learn more about different types of rules in Azure IoT Central and how to parameterize the rule definition, see: