How to Make WordPress and the Internet of Things Work Together
After several false starts, the “Internet of Things” is beginning to deliver on its revolutionary promise.
The technology is finally here to make it happen and the world is increasingly awash with connected devices. In this article, we’ll examine what this trend could mean in the context of WordPress (hint: cool stuff) and the role the REST API (which will be included in version 4.4, due out next week) will play in making WordPress able to talk to devices.
What Is the Internet of Things?
Unless you’ve been beavering away at the cutting edge of modern digital device manufacturing for the last decade or so, the term Internet of Things (we’ll refer to it as IoT from here on) might be something of a new idea for you. Let’s get the basics out of the way early:
The concept of IoT is blindingly simple – it’s about connecting devices worldwide via the internet. Rather than the internet being limited to humans communicating via desktop or mobile machines, the idea is that a huge range of new internet-enabled devices will be merrily chatting away to each other in the very near future.
“The broad idea… is that a whole constellation of inanimate objects is being designed with built-in wireless connectivity, so that they can be monitored, controlled and linked over the Internet via a mobile app.” – Walt Mossberg, Re/code.
What sort of devices are we talking about here? The short answer is every type of freakin’ device.
Can anyone say ‘Skynet’?
Just kidding… I think…
The archetypal example has traditionally been a household device such as a toaster or fridge that would be hooked up to the internet and capable of sending messages about, for example, whether a part was about to burn out or whether you were running low on particular supplies.
You could be talking about anything from self-aware devices with their own operating systems (fridges, cars, and so on), to completely dumb physical objects that have been equipped with sensors, all the way up to biological “devices” such as RFID-chipped livestock.
This new world of potentially smart devices then needs to be able to communicate with the world at large via some sort of wireless means. As Bonnie Cha points out in her IoT piece on Re/code, there are all manner of existing standards available that devices can make use of. Wi-fi, low-energy Bluetooth, NFC, and RFID are just some of the more obvious traditional ones.
Where We Can Expect to See IoT Make Huge Inroads
The scale of opportunity coming down the pipeline with IoT is such that it’s no exaggeration to say this will eventually effect pretty much every industry on earth in a substantial way. It’s simply a matter of time.
The standard set of figures that are trotted out is that we can expect to see 50 billion connected devices by 2020 contributing to an overall market opportunity of $19 trillion. Pretty much every single major tech company on earth is already devoting serious resources to this area – giants such as Cisco have formed entire new divisions to target the opportunity.
The good folks over at Information Is Beautiful have put together a killer overview of IoT in general that makes an excellent case for breaking out potential applications into eight separate areas:
Connected home: Nest has been in the spotlight here with their recent $3.2 billion purchase by Google, but the field is enormous. Companies such as Ring, LIFX, Icontrol and Vivint are connecting all aspects of our domestic lives on a device level.
Industrial internet: Whether it’s optimizing building energy sources, creating smart factories, or leveraging the power of drones, the next generation of industry is going to have IoT at its core.
In-store retail: In-store analytics and customer behavior analysis are being taken to whole new levels thanks to a range of innovative IoT devices and associated software.
Transport: Solutions such as Zubie and Inrix make transport safer and cheaper on the consumer level, while public transport as a whole is undergoing revolutionary changes worldwide thanks to IoT technology.
Healthcare: The healthcare potential of IoT is staggering. The early health benefits of aware devices such as the Apple Watch are garnering positive headlines, but that’s just the tip of the iceberg. Innovations such as Intel’s smart band, the Sonamba medical alert system, and AliveCor show IoT technology already revolutionizing healthcare and actively saving lives.
Platforms: The race is on to be the platform that dominates device use on both the consumer and business side of the equation. IFTTT, mCube, Jasper, and littleBits are just some of the contenders in the running.
Wearables: Companies such as Pebble, Jawbone, and Fitbit made much of the early running here, but the arrival of Apple and Samsung shows that the larger players are catching up fast. The future of wearables is likely to move far beyond the wrist sooner rather than later.
Global players: As the areas above make clear, there are huge markets to be aimed at here, and it’s no surprise that a full range of existing tech giants are queuing up to take a bite out of the cherry. Google, Cisco, Samsung and Intel are just some of the major companies devoting significant resources to IoT.
The Potential Risks of IoT
We’ve concentrated on the good news so far but, as with any new technological wave there are potential downsides to consider.
Looking beyond the terrifying Skynet-style scenario of “summoning the demon” that a fully connected world invokes, thanks to Terminator, two major obvious risks stand out:
- Security: The most obvious potential hiccup that IoT brings into play is security. When you consider the range of disastrous security implications that even smart phones have conjured up, the idea of having your entire house or means of transport hacked is pretty worrying.
- Privacy: If IoT arrives at anything approaching the scale of even cautious forecasts of its adoption, it’s a fair bet that we can kiss the concept of privacy as we currently know it goodbye. Concerns over concepts like cookie usage are going to look positively quaint when our entire immediate physical environment is busily reporting on our every move.
The Role of the REST API in Making WordPress Able to Talk to Devices
When you start to consider the implications of a globally connected world on the device level, it quickly becomes obvious that the WordPress REST API is arriving into core at just the right time (it has been merged into WordPress 4.4, which is due out on December 8).
With billions of devices out in the wild chatting away to each other, the future of the web is obviously going to be heavily dependent on having clear protocols and open APIs available to facilitate that communication – which is exactly what the REST API is designed to do.
The standard range of endpoints it enables gives you access to pretty much everything in WordPress core. You’ve also got the option of defining your own endpoints for custom use cases. If you’re brand new to this area, Daniel Pataki put together a great overview of getting up and running with the REST API here on the blog recently that’s well worth a read.
Having a fully-fledged API defined for WordPress means there is an established route available for external devices to communicate directly with WordPress and vice versa. The potential range of applications here is dazzling, but all of them rest on this clear data in/data out pathway being available for use.
Let’s take two hypothetical examples:
- Push notifications: The owner of a WooCommerce-enabled store wants to boost morale every time a sale is made. A little tinkering with the WooCommerce API and littleBits enables him to ring a real-world sales bell in the office every time a sale is made. Check out Scott Evans’ lightning talk at WordCamp London and his Sparky plugin for tips on how you could mock this up.
- Data aggregation and display: A health-conscious blogger is reveling in using his new Apple Watch to track various exercise movement metrics. He rigs up WordPress to talk directly with Apple’s Healthkit and he’s able to seamlessly integrate his own personal health data into any aspect of his WordPress environment.
Our two hypothetical examples are limited in scope but, as the possibilities of the REST API begin to be truly explored by WordPress developers, the potential for integration with IoT devices is likely to be bound only by our imaginations down the line.
For an excellent current snapshot of how WordPress is positioned to benefit from the possibilities IoT opens up, check out Thomas Puig’s WordPress and the Internet of Things presentation below.
Hopefully the scale of the opportunity potentially on offer here is starting to become clear by now.
Let’s move on to a quick look at existing external APIs, products and services that you can use to communicate directly with internet-enabled devices from within WordPress.
Integrating WordPress with Third-Party Devices
It’s still relatively early days in IoT, so there is as yet no universally implementable way of connecting to any and all devices. Direct IoT integration with WordPress to date has been somewhat limited with early projects such as the Nike+ plugin and Google Glass plugin withering on the digital vine.
Expect all of that to change soon, however, as the number of solid third-party systems you can easily use to integrate with either existing or brand new IoT devices continues to grow. Here’s a quick list of three likely candidates for your own projects.
IFTTT (short for If This, Then That) is centered around two basic concepts: DO recipes and IF recipes. The idea is that you can cause outcomes to happen (the DO part) in response to certain events (the IF part).
IFTTT recipes can be run against particular services (or Channels as they are defined in IFTTT) and WordPress is one of the existing options (be sure to check out our previous WordPress and IFTTT post for more details).
In the context of IoT, you’re free to make use of either triggers (events that take place inside WordPress) or actions (actions that can be made to take place inside WordPress) to integrate with external applications. Available triggers are Any new post and New post with tag or category. Available actions are Create a post and Create a photo post.
A range of external devices can already by connected via IFTTT including Fitbit, ScoutAlarm and many others, but it’s the recently added Maker Channel that will really give you room to play with connecting WordPress to a custom piece of hardware of your choosing in any way you see fit.
If you’re going down the maker route in terms of creating your own IoT devices, littleBits is going to be a particularly interesting option to explore. It’s a platform of easy-to-use electronic building blocks that enable you to create your own devices from scratch and connect them to the wider world via the littleBits API or through IFTTT.
A littleBits WordPress plugin is also available to make connecting WordPress and littleBits even simpler. It’s the brainchild of RC Lations, whose WordPress.tv talks are also worth consulting on the topic of IoT and WordPress.
Formerly known as Spark, Particle is a prototype-to-production platform for developing an IoT product. If you’re looking to get down and dirty with building your own electronics – and have one eye on a possible real-world product path – Particle is well worth investigating.
Development kits give you a quick way of putting together a workable prototype and detailed prototype to production guides are available to walk you through every aspect of making a finished product. A custom IDE is available to make developers’ lives easier and Particle also provide their own cellular platform and device management options.
When it comes to WordPress integration, you can keep things simple using the Spark Channel on IFTTT or dive right into the Particle REST API. Demo plugins such as Scott Evans’ Sparky plugin should also help point you in the right direction.
The Internet of Things is an idea whose time has come. We’re currently at the very beginning of a rush towards a future where the vast majority of devices we interact with are internet-enabled.
As an open source platform that’s not beholden to any particular device manufacturer or special interest, WordPress is a natural choice for displaying much of the data this explosion of devices will produce in user-friendly ways. And thanks to the imminent arrival of the REST API, WordPress should also be a simple choice for developers to use when it comes to hooking up with individual devices and solutions such as littleBits, Particle and IFTTT.
We’d love to get your thoughts on the matter. Are you already planning for an IoT world and trying to work out where WordPress fits in? Or is this still the stuff of far off futures? Let us know in the comments section below.
Image Credits: BagoGames.