Micro Focus is now part of OpenText. Learn more >

You are here

You are here

App nirvana: When the Internet of Things meets the API economy

public://pictures/davidl.jpg
David Linthicum Chief Cloud Strategy Officer, Deloitte Consulting
 

With the Internet of Things (IoT) market projected to reach 7.1 trillion dollars by 2020 according to IDC, it's no surprise that many businesses are anxious to develop applications that support these devices. IoT is driving a new area of the market, namely IoT application development. But exploiting IoT device interfaces to integrate your applications with those devices can be tricky, and knowing how to get the most value from IoT devices can be even trickier.

The IoT encompasses a wide range of devices, from the Nest smart thermostat, to the Fitbit, to industrial robots that assemble cars. Indeed, on the factory floor, smart devices capable of machine-to-machine (M2M) communications were already a huge market before someone put the IoT label on it.

While there isn't much difference in how you develop the application itself, supporting IoT devices does require that software engineers become proficient with device-level application programming interfaces (APIs). IoT integration is all about APIs, the logical connectors that allow applications to communicate with each manufacturer's IoT devices. APIs expose data that enables those devices to transmit data to your applications, acting as a data interface. Or, they can allow your application to control the device and serve as a function interface.

While device manufacturers are taking steps to ensure that their APIs are well defined, developers must learn how to use IoT device interfaces effectively. Fortunately, third-party providers are also producing tools that make using each IoT device manufacturer's APIs easier for developers.

Learning by example: The Nest API

Here's an example of how to get started. Let's say you want to communicate with a Nest smart home thermostat. The Nest is Wi-Fi enabled and remotely controllable using a mobile app or by browsing to your account on the Nest website.

While Nest has built applications that can communicate with its own smart thermostats, smoke detectors, and other products, it also offers an API that your applications can use to communicate with Nest devices. This also means that you can build and sell applications that can receive and exploit Nest data.

Data within the Nest API is built on the notion of devices in structures. With this API, all data is addressable by way of a URL that Nest calls the "data location." Each data location can store strings, numbers, and Booleans.

You can use the Nest API to sync data from data locations at multiple levels in the hierarchy. Nest cites these examples:

  • An entire structure, including all devices
  • A single device in a structure
  • A group of data values (current and ambient temperature)
  • A single data value (battery health state)

Of course, you don't want unauthorized access to your thermostat or smoke detector data, so Nest requires that you have permission to access the data.

While there are some great API and code examples out there, I find Nick Branstein's Nest API code examples to be the easiest to understand. For example, here's the code for reading all the settings from a Nest thermostat:

function getNestData() {

var accessToken = $.cookie('nestAccessToken');

ar ref = new Firebase('wss://developer-api.nest.com');

ref.auth(accessToken);

ref.on('value', function (snapshot) {

console.log(snapshot.val());

});

As you can see, there's not much to it. You use the device as a data source, and then you can use the data for any purpose, including predictive analytics, machine learning, or simple interactions with other applications. In fact, according to EDC's Internet of Things Study 2015, 79 percent of IoT application developers spend at least 25 percent of their time with analytics or databases, while 42 percent work on big data or advanced analytics projects.

But Nest is just one example. There are thousands of devices out there that use similar APIs to access data or control IoT devices. Unfortunately, while some are well defined and designed, for others (mostly older devices) you'll have to write your own API to abstract data from primitive device interfaces.

The good news is that a set of approaches and best practices are emerging around the use and development of IoT device APIs. Already, most devices out there have either open APIs, or APIs that the manufacturer uses internally. It's no surprise, then, that developers who know how to design or leverage device APIs are in high demand.

The data interface

With so many IoT devices out there, many organizations are focused on gathering data from all connected devices. Data interfaces are key and can be used for such things as:

  • Determining data patterns that may require fixes or maintenance. For example, data generated by jet engines can be analyzed to determine whether an engine needs attention ahead of regular maintenance.
  • Data produced by drones that are programmed to orbit agricultural fields to determine the effectiveness of irrigation
  • Data produced by a health activity tracker may indicate that the wearer is in danger of suffering from heatstroke or heart attack. Activity trackers are also being used as tools physicians can use to track higher-risk patients between exams.

While the types of data accessed on devices vary greatly, common uses include placing that data within big data systems for data analytics processes to analyze the data in real time or near real time.

Data science is joined at the hip with IoT. Pulling the data off devices is becoming easier, and offline analysis of the data is where innovation is occurring. For example, healthcare providers might analyze health telemetry data to gather information from patients, look for patterns that the patient might change to improve wellness, or diagnose diseases earlier.

The function interface

The function interface controls the device. People have been doing this for years with process control systems, dashboards, and so on. Now the idea is to provide interfaces that let applications perform the same function, such as building an application that can shut off the fuel system in your car when the airbag deploys or that lets the power company automatically turn up the temperature on your thermostat on warm days to save power and avoid a brownout. Many smart thermostats, such as EcoFactor, now work with power companies to provide these "load-shedding" capabilities, offering thermostat owners significant cost savings, while allowing the utility company to avoid building more carbon-producing power plants to keep up with peak demand.

Linking with the cloud

The cloud is a key enabler for the IoT. In the EDC Internet of Things Study, more than half (55 percent) of IoT developers said that they connect to devices primarily through the cloud, with 32 percent saying they connect through a hub or middle tier. More than a quarter (26 percent) of IoT developers said that they associate cloud computing with the IoT, and that group of respondents was three times more likely to use the cloud as a development environment.

Currently, nearly four in 10 (37.9 percent) of IoT apps are being developed in the cloud and nearly half (49.6 percent) of developers plan to begin development in the next year. Just 5.5 percent of IoT developers had no plans to build apps in the cloud.

Software engineers who build IoT applications using APIs need a quick way to provision resources to provide the massive amounts of data storage required, and the fact that public clouds are already API-oriented is a big advantage. In essence, developers take an API, or service-oriented approach to development. Building applications is about creating composites of services: cloud services/APIs and device services/APIs.

By taking this approach, you can abstract your application away from the underlying complexities of dealing with data storage and device communication. Moving forward, new technologies will come onto the scene to make IoT development even easier, including tools for API management and security.

Use the data to innovate

What's most important to understand about the IoT is the number of different, high-value applications involved, from better health to safer travel. The value of the IoT isn't in what's been done but what you can do with it going forward.

For year, software engineers have designed applications that communicate with devices, machines, and "things." What has changed is the power of available resources they can use to process and store IoT data and the cost-effectiveness of the devices themselves. For example, I created high-speed data acquisition devices in the late 1980s that cost millions of dollars. These days, the same technology would cost $500 or less.

As those technologies become more powerful and cost-effective, so will the IoT. Big data and the cloud are IoT enablers, so software engineers who want to build applications that fully exploit these devices—whether it's a factory robot, a drone, or a Nest thermostat—should focus on what they can do with the data.

Keep learning

Read more articles about: App Dev & TestingApp Dev