Introduction to SmartThings SmartApps

SmartApps are written in Groovy, and can be found within the "Add a SmartApp" menu inside of SmartThings. SmartThings provides a number of SmartApps and SmartApp categories right out of the box, so you can just pick an existing one and be up and running. In addition to that, you can self-publish your own SmartApps directly within SmartThings Graph, or publish SmartApps to GitHub for yourself or others to use. I'll talk more about the latter options when we get to creating our own SmartApp in a future post. You can think of a SmartApp almost as a Routine on steroids. SmartApps are a way to run complex logic, calculations, or even call external services as part of the automation.

To illustrate the power of the out of the box SmartApps, let's look at the Vacation Lighting Director SmartApp, which automatically makes your home appear occupied when you're away. This is the modern alternative to running around the house setting individual light timers before you hit the road for your trip.

SmartApps are located right alongside "Routines" in the automation panel, and clicking "Add a SmartApp" will present you with a list of available/installed SmartApps.

Scroll down and tap on the "Lights & Switches" category, and you'll find a list of lighting related SmartApps. The list of apps that SmartThings includes out of the box varies from time to time, and you'll notice that some of the SmartApps, including the "Vacation Lighting Director" were not actually written by SmartThings. If you read my Home Automation Kickoff post you'll remember my praise to SmartThings for embracing the community and extensibility of the SmartThings platform. The fact that they're actually evaluating, selecting, and publishing best of breed apps under names other than their own is one big example of this.

If we select the "Vacation Lighting Director" you'll see that unlike Routines, SmartApps may actually have many layers of configuration options to them. While this is an example of a powerful SmartApp, they really can be taken as far as you (or another developer) want to take them. Here we're prompted to do some setup, configure additional settings, and name our app.

Within the setup menu, we can set the mode(s) that the app will run during. Modes are a great way to isolate sensor logic or automation when it is dependent on different conditions. By default SmartThings has a mode for Home, Away, and Night, but custom modes can also be created. As an example, you could use a custom "Vacation" mode that changes alert and notification properties of a SmartApp so that you get notified under different conditions than if your home was simply in "Away" because you went to the grocery store.

The options highlighted in red are options that we have to complete for the SmartApp to function. For now we'll set it to run when "Away", and scroll down for the rest of the options.

The SmartApp needs to know what lights we want it to turn on and off to represent your house being occupied, how often we want it to change those lights, and how many lights should be on at a time. For this example I only selected two lights, but you could conceivably select many, many more.

Tap "Done" to go back to the main SmartApp configuration screen, then tap "Settings" to see the additional options on this SmartApp. None of these options are required, but we have the ability to set a delay on the start. This is useful if you've configured the SmartApp to run under say "Away" mode, and you accidentally put your system into "Away". This gives you a window to set it back before the simulation runs. We also have options to only run on certain days of the week, or if presence indicators indicate specific people are home. The latter is useful if you want the simulation to automatically stop when you return home.

Now that we've completed the configuration of our SmartApp, it's just a matter of clicking "Done" to go back to the main Automation screen. The SmartApp has been configured and will now run automatically when the configured conditions are met.