title | description | services | author | ms.author | ms.date | ms.topic | ms.service | manager |
---|---|---|---|---|---|---|---|---|
Build workflows with the IoT Central connector in Microsoft Flow | Microsoft Docs |
Use the IoT Central connector in Microsoft Flow to trigger workflows and create, update, and delete devices in workflows. |
iot-central |
viv-liu |
viviali |
09/18/2018 |
conceptual |
iot-central |
peterpr |
This topic applies to builders and administrators.
Use Microsoft Flow to automate workflows across the many applications and services that business users rely on. Using the IoT Central connector in Microsoft Flow, you can trigger workflows when a rule is triggered in IoT Central. In a workflow triggered by IoT Central or any other application, you can use the actions in the IoT Central connector to create a device, update a device's properties and settings, or delete a device. Check out these Microsoft Flow templates that connect IoT Central to other services such as mobile notifications and Microsoft Teams.
- A Pay-As-You-Go application
- A Microsoft personal or work or school account to sign into Flow (learn more about Microsoft Flow plans)
This section shows you how to trigger a mobile notification in the Flow mobile app when a rule is triggered in IoT Central.
-
Start by creating a rule in IoT Central. After you save the rule conditions, click the Microsoft Flow action as a new action. A new tab or window should open in your browser, taking you into Microsoft Flow.
-
Sign into Microsoft Flow. This doesn't need to be the same account as the one that you use in IoT Central. You'll land on an overview page showing an IoT Central connector connecting to a custom action.
-
Sign into the IoT Central connector and click Continue. You are taken to the Microsoft Flow designer to build your workflow. The workflow has an IoT Central trigger that has your Application and Rule already filled in.
-
Choose + New Step and Add an action. At this point you can add any action you want to your workflow. As an example, let's send a mobile notification. Search for notification, and choose Notifications - Send me a mobile notification.
-
In the action, fill in the Text field with what you want your notification to say. You can include Dynamic content from your IoT Central rule, passing along important information such as device name and timestamp to your notification.
[!NOTE] Click the "See more" text in the Dynamic content window to get measurement and property values that triggered the rule.
-
When you are done editing your action, click Save. You'll be directed to your workflow's overview page. Here you can see the run history and share it with other colleagues.
[!NOTE] If you want other users in your IoT Central app to edit this rule, you must share it with them in Microsoft Flow. Add their Microsoft Flow accounts as owners in your workflow.
-
If you go back to your IoT Central app, you'll see this rule has a Microsoft Flow action under the Actions area.
You can always start building a workflow using the IoT Central connector in Microsoft Flow. You can then choose which IoT Central app and which rule to connect to.
This section shows you how to create a new device in IoT Central at the push of a button on a mobile device using the Microsoft Flow mobile app. You can use this action in Flow to integrate ERP systems like Dynamics with IoT Central by creating a new device when a device is added elsewhere.
-
Start by creating a blank workflow in Microsoft Flow.
-
Search for Flow button for mobile as a trigger.
-
In this trigger, add a text input called Device name. Change the description text to be Enter the device name of your new device.
-
Add a new action. Search for the Azure IoT Central - Create a device action.
-
Pick your application, and choose a device template to create a device from in the dropdowns. You'll see the action expand to show all the properties and settings of the device.
-
Select the Device Name field. From the dynamic content pane, choose Device Name. This value will be passed from the input the user enters through the mobile app, and will be the name of your new device in IoT Central. In this example, the only required field is the device name, indicated by the red asterisk. Another device template may have multiple required fields that need to be filled in to create a new device.
-
(Optional) Fill in other fields as you see fit for your creating new devices.
-
Finally, save your workflow.
-
Try your workflow in the Microsoft Flow mobile app. Go to the Buttons tab in the app. You should see your Button -> Create a new device workflow. Enter the name of your new device, and watch it show up in IoT Central!
This section shows you how to update device settings and properties in IoT Central at the push of a button on a mobile device using the Microsoft Flow mobile app.
-
Start by creating a blank workflow in Microsoft Flow.
-
Search for Flow button for mobile as a trigger.
-
In this trigger, add an input like a Location text input that corresponds to a setting or property you want to change. Change the description text.
-
Add a new action. Search for the Azure IoT Central - Update a device action.
-
Pick your application from the dropdown. Now you'll need an ID of the existing device you want to update. You can get the ID of the IoT Central device in the browser URL.
-
You can update the device name. To update any of the device's properties and settings, you must select the device template of the device you want to update in the Device Template dropdown. The action tile expands to show all the properties and settings you can update.
-
Select each of the properties and settings you want to update. From the dynamic content pane, choose the corresponding input from the trigger. In this example, the Location value is propagated down to update the device's Location property.
-
Finally, save your workflow.
-
Try your workflow in the Microsoft Flow mobile app. Go to the Buttons tab in the app. You should see your Button -> Update a device workflow. Enter the inputs, and see the device get updated in IoT Central!
You can delete a device by its device ID using the Azure IoT Central - Delete a device action. Here is an example workflow that deletes a device at the push of a button in the Microsoft Flow mobile app.
If you are having trouble creating a connection to the Azure IoT Central connector, here are some tips to help you.
-
Microsoft personal accounts (such as @hotmail.com, @live.com, @outlook.com domains) are not supported at this time. You must use an AAD work or school account.
-
To use the IoT Central connector in Microsoft Flow, you must have signed into the IoT Central application at least once. Otherwise the application won't appear in the Application dropdowns.
-
If you are receiving an error while using an AAD account, try opening Windows PowerShell and run the following commandlets as an administrator.
Install-Module AzureAD Connect-AzureAD New-AzureADServicePrincipal -AppId 9edfcdd9-0bc5-4bd4-b287-c3afc716aac7 -DisplayName "Azure IoT Central"
Now that you have learned how to use Microsoft Flow to build workflows, the suggested next step is to manage devices.