Trending & Analyzing SmartThings Devices (Part 1 of 4)

Table of Contents


Back in the Home Automation Kickoff post, I talked about the power of the mFi Controller to record, trend, and analyze device and energy usage. One of the huge disappointments with Ubiquiti ending development of the mFi Controller was the end of development related to these capabilities. SmartThings has proven itself to be a fantastic platform for the integration and management of physical devices, but offers essentially no analytics around those devices. You can pick up devices like the fantastic Aeotec Smart Switch, which will report power measurements to the SmartThings UI, but that data is simply a reading at that moment. I feel compelled to point out that I have said previously that the Ubiquifi mFi mPower Mini is the best WiFi controlled switch I've ever used. If that device had a cool Z-Wave cousin, it would in fact be the Aeotec Smart Switch.

SmartThings has no mechanism today to do anything with the data its' devices report, other than use it as conditions in automation (which in itself is incredibly powerful—I'm in no way trying to belittle those capabilities). Nor do I believe SmartThings should try and become an analytical platform. They've cracked what they're good at, and trying to be everything to everyone is never a good product strategy (spoken as a product guy).

But all that said, if you're using devices like the Aeotec Smart Switch, you probably want to be able to trend that data. This is a perfect scenario for an external platform to store, analyze and trend this data, and a perfect example of a more powerful, custom SmartApp for SmartThings. In the next couple posts, we'll deploy and configure InfluxDB to record the data from SmartThings devices, a custom SmartThings SmartApp to send the data from SmartThings to InfluxDB, and we'll use Grafana to visualize and trend the data from InfluxDB.

These four posts will be the foundation for many of the future posts in this Home Automation series, and I've broken the content into separate posts to make them a little easier to digest.

Platform Concepts

For this project, I've created two Virtual Machines (one for InfluxDB and one for Grafana). I've taken this approach for a couple of reasons. The first being that I plan on having a lot of devices and a lot of data to store (data that I'd like to keep for a long time for trending). The second (and perhaps more relevant) reason is that I have hardware here that I can run these Virtual Machines on. Depending on your scenario there's a few alternative approaches you can take:

Raspberry Pi

I'm a huge fan of the Raspberry Pi. It was the first affordable, small form factor, single board computer that really went mainstream. You can find them pretty much anywhere, and there's a huge amount of community support. If you opt to go the Raspberry Pi route, I'd strongly recommend a Raspberry Pi 3, since the third generation has a bit more horsepower. You'll also want to make sure you get a good, fast and large enough Micro SD to hold the software and the amount of data you want to keep. Something like the Samsung Evo Plus cards is usually a good choice here.


You may have seen my previous posts on the Pine64, but if you haven't I'll summarize here. Like the Raspberry Pi, the Pine64 is a single board computer, with a few subtle differences. The quad-core ARM processor is faster than a Raspberry Pi 3, and the Pine64 is available in a 2Gb variant that comes with 2Gb of memory as opposed to the Raspberry Pi 3's 1Gb. In many ways, the Pine64 is a lesser-known, but more powerful AND cheaper option. It's newer, so OS compatibility is a little more spotty, and you have to be willing to do a little more work to get up and running. If that's your thing, you can follow my previous posts to help you get started as the steps will be very similar here.

Cloud Host

If you'd rather not mess with hardware, and just want to get started, spin up a cloud virtual machine at Digital Ocean. Digital Ocean is a great platform for these sorts of projects. Their servers (called Droplets) are as little as $5/month, come with SSD storage, run just about any flavor of Linux you could want. Oh, and they provision in as little as 60 seconds.