Azure IoT Conditionals¶
Conditional Processing or Execution Conditions gives you the power to decide if a particular action on Azure IoT will be executed or not when the workflow is triggered by the incoming event. This is similar to the if-then-else logic applied to the execution of an action based on the attribute from the trigger event of the workflow.
Think of Conditional Processing as the equivalent of if-then-else, as decision diamond in the flow chart, or the Conditional Branching in BPEL (Business Process Execution Language).
You can add conditional processing to any action in your workflow and evaluate which actions should be performed in response to a particular trigger event identified by its characteristics or the data attributes. You can apply complex logic using AND, OR and grouping of such conditions. Each of the conditions supports different operators based on the event data type being a string (abc and/or 123), number (123), boolean (true/false) etc. Read here to find more about Conditional Processing.
Example Scenario¶
We will take a scenario where you are using Azure IoT as the trigger application. There could be multiple application actions invoked upon receiving an Azure IoT trigger. Each of the actions in the flow would apply its execution condition(s) based on the data attributes of the Azure IoT trigger event. This will allow each of the actions to independently choose to execute based on the defined execution conditions.
In this example, the workflow is triggered when a New Event or message is received on a configured IoT device.
If your workflow has Azure IOT as the trigger application, the attributes available for creating conditions for Conditional processing depend on whether your device sends Structured Data or Unstructured Data.
If the device sends unstructured data, you can filter on the basis of IoT data
. In Figure 1, the IoT device is sending unstructured data. The action on Microsoft Teams will only be performed if the IoT data contains Tubelight.
If the device sends structured Data, you can use the values of different keys for filtering along with using IoT data. In the example shown in Figure 2, the IoT device sends structured data. The action on Microsoft Teams will be performed only if the Value of key Temperature
is more than 100.