Quickstart: Configure rules and actions for your device in Azure IoT Central
Get started with IoT Central rules. IoT Central rules let you automate actions that occur in response to specific conditions. The example in this quickstart uses accelerometer telemetry from the phone to trigger a rule when the phone is turned over.
In this quickstart, you:
- Create a rule that detects when a telemetry value passes a threshold.
- Configure the rule to notify you by email.
- Use the smartphone app to test the rule.
- An Azure account with an active subscription. Create an account for free.
- Complete the first quickstart Create an Azure IoT Central application.
Create a telemetry-based rule
The smartphone app sends telemetry that includes values from the accelerometer sensor. The sensor works slightly differently on Android and iOS devices:
When the phone is lying on its back, the z value is greater than
9, when the phone is lying on its front, the z value is less than
To add a new telemetry-based rule to your application, in the left pane, select Rules.
To create a new rule, select Create a rule.
Enter Phone turned over as the rule name.
In the Target devices section, select IoT Plug and Play mobile as the Device template. This option filters the devices the rule applies to by device template type. You can add more filter criteria by selecting + Filter.
In the Conditions section, you define what triggers your rule. Use the following information to define a single condition based on accelerometer z-axis telemetry. This rule uses aggregation, so you receive a maximum of one email for each device every five minutes:
Field Value Time aggregation On, 5 minutes Telemetry Acceleration / Z Operator Is less than Aggregation Minimum Value -9
To add an email action to run when the rule triggers, in the Actions section, select + Email.
Use the information in the following table to define your action and then select Done:
Setting Value Display name Your phone moved To Your email address Notes Your phone is face down!
To receive an email notification, the email address must be a user ID in the application, and the user must have signed in to the application at least once.
Select Save. Your rule is now listed on the Rules page.
Test the rule
Shortly after you save the rule, it becomes live. When the conditions defined in the rule are met, IoT Central sends an email to the address you specified in the action.
To trigger the rule, make sure the smartphone app is sending data and then place it face down on your desk. After five minutes, IoT Central sends you an email to notify you that your smartphone is face down.
After your testing is complete, disable the rule to stop receiving the notification emails in your inbox.
In this quickstart, you learned how to create a telemetry-based rule and add an action to it.
To learn more about integrating your IoT Central application with other services, see:
Submit and view feedback for