Building complex IoT applications.. How workflows can help?

When we talk about IoT, mostly we are thinking about registering a set of devices, monitoring them, controlling them and analyzing data gathered from those devices. However, once we have these common IoT functions in place, we can think of advanced use cases, where more complex interactions among devices, external systems and humans are necessary.

Let’s consider one such use case - a smart home. A smart home may have temperature sensors to monitor temperature of each room, outside environment and tap water. There can also be motion sensors to detect movements and IR sensors to identify presence of people. In addition, smart home can be equipped with network controlled actuators such as gates, door locks, light bulbs, window blinds, air conditioners and water heaters. By integrating these devices with an IoT platform, we can securely control and monitor these devices. For example, while sitting in front of the laptop, home owner can lock the main door or check the tap water temperature.

Now consider this scenario.. When the owner the home arrives, we want to open the gate, unlock the front door and adjust the living room temperature value according to his preference for the current time. Further, if it is a time where the owner usually takes a bath, ask the owner whether to heat water. In addition, if there were suspicious movements, alert the owner before opening the gate. Obviously, this is a workflow. i.e a set of activities that has to be performed according to a predefined procedure. Therefore, this behavior can be achieved by integrating a workflow system with IoT platforms. Let’s see how..

IoT platforms provide device provisioning and authentication, so that we know how to address each device securely. Then it provides a way to send commands to devices. Such platforms also provide a way to read data sent from each device. Usually, all these functions are exposed as APIs. On the other hand, a workflow system supports performing activities based on a logical flow. Such activities can be an invocation of an API or getting input from a user. In addition, a workflow can listen and react to external events, such as detection of a movement or connection of a device to the network. For example, in our use case a workflow can be started when the RFID tag attached to owner’s car is detected by the RFID reader installed near the gate. Most importantly, workflows allow us to model the flow of activities, so that we may specify flows such as water heater should be turned on if water temperature is less than 25 C, or reading the outside temperature and querying suspicious movements within past 2 hours can be performed in parallel.

Therefore, by combining features of IoT platforms and workflow systems, we can build advanced IoT applications with complex device interactions. Below is a possible model for the example scenario we discussed:

The flow starts when the RFID reader placed near the gate detects a presence of a RFID tag (we assume that a RFID tag is attached to owner’s car). Once detected, RFID reader sends an event to the IoT platform with the the tag ID. IoT platform sends this data to all authorized subscribers, which includes the workflow system. As a result of this, the workflow system starts the arrival workflow depicted above. Let’s go through the first five steps to understand this in bit more detail (refer to the above figure):

Similarly, all relevant steps in the workflow will be activated based on applicable conditions. In this way, we can implement advanced IoT applications by integrating workflows with IoT platforms, so that IoT platforms expose devices securely while workflows provide logical flow for coordination among devices and external entities.

PhD, Software Architect, Academic

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store