Mastering a power outage in the smart home

Bad Condition

Programming with the SmartThings API is recommended only for hobbyists with a great deal of patience. Samsung's SmartThings department seems to be the unloved stepchild of the organization's other divisions. Not only is the documentation inadequate and at times contradictory, even the source code of the hub core is inaccessible. Even worse, Groovy's own self-inspection mechanisms have been undermined so that not even go-getters can discover the true names of incorrectly documented attributes.

In the case at hand, a simple API call to ask the hub whether it currently is powered by the grid or the reserve batteries would have sufficed to solve the problem, instead of having to resort to Rube Goldberg-esque solutions such as the one I just described. If the hub code were open, dedicated hobbyists could fill in the gaps in the API on GitHub and make it a much better product.

The app keeps crashing, the web page for developing SmartApps has been cobbled together rather haphazardly, and serious functional flaws are evident (e.g., the Update button for changing a SmartApp's metadata does not work). If you think that developer access will work via, you will discover in the forum that you need to stipulate graph-na02-useast1 instead of graph in the United States and graph-eu01-euwest1 in the UK; otherwise, the API won't find the user's hub equipment, who is no doubt busy tearing their hair out in frustration. They should be using the industry standard of sharding via the username instead.

However, there is a dedicated community that molds the breadcrumbs uncharitably thrown to it into working applications. The only correct strategy for Samsung has to be opening up the entire project, including the communication protocols used, and leaving it to the community to transform it into a maintainable platform with a future. There is certainly enough potential.


  1. "How-to Geek: How to Select a Battery Backup for Your Computer":
  2. "IFTTT Home Automation" by Mike Schilli, Linux Pro Magazine, issue 189, August 2016, pg. 60,
  3. SmartThings Hub by Samsung:
  4. "Video Preview" by Mike Schilli, Linux Pro Magazine, issue 195, February 2017, pg. 52,
  5. SmartThings API tutorial:
  6. Listings for this article:
  7. "WiFi Connect Messages" by Mike Schilli, Linux Pro Magazine, issue 186, May 2016, pg. 64,
  8. Prowl:

The Author

Mike Schilli works as a software engineer in the San Francisco Bay area of California. In his column, launched back in 1997, he focuses on short projects in Perl and various other languages. You can contact Mike at

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • AcpiTool and PowerTOP

    AcpiTool and PowerTOP ensure a sustainable battery lifetime and guarantee low energy consumption of laptops running Linux by identifying power hogs and maintaining the battery.

  • Smart Cities

    Making the city of Messina, Italy, smarter with open source and IoT.

  • Wildlife Photo Trap

    Armed with no more than a Raspberry Pi photo trap, you can discover who pays a visit to your garden at night.

  • Z-Wave Home Assistant

    Z-Wave components, a RaZberry module, and the free Home Assistant software make the Raspberry Pi a powerful smart home control center.

  • Perl: Uninterruptible Power Supply

    An uninterruptible power supply can help get you through a short power outage without losing data or damaging hardware. A Nagios script written in Perl checks UPS health and initiates a controlled powerdown if the unit exhausts its battery capacity.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More