A re-useable library for SmartThings SmartApps. Born out of the need to share re-useable code across various SmartApps. These are various best practices for how to operationalize and instrument your SmartApp.
You are encouraged to contribute your own re-useable functions and helpers.
This library is licensed as Apache V2 and hosted on github: https://github.com/fxstein/smartthings-smartlib
These are some of the primitives included in the library:
To better support debugging and operationalization here are some logging helpers to be used instead of
code example
Commonly required data type conversions when building Apps for SmartThings
code example
Describe install and setup required for the SmartLib library
When developing SmartApps and custom devices for SmartThings in Groovy there are some useful tools to help with productivity and where the online IDE falls short.
-
First consider using github for your primary repository of all your work. Track changes, label versions and allow others to contribute through pull requests.
-
Depending on your platform install and setup the github client: Mac | Windows
-
The development team at github open-sourced their howgrown highly flexible and extensible editor: Atom
-
In order to add groovy support to Atom simply add Groovy Language Support
Should not take more than 5-10 minutes to get you up and running.
Leverage the tool set of your choice or the selection listed above for all your edit, version control, issue tracking and collaboration and simply Copy/Paste your App Code into the SmartThings Online IDE
Wishlist: RESTful API to allow a developer to upload and publish the source code for an App
These are some useful resources that will help you develop better SmartThings Apps and device drivers.
Always looking for a suitable icon for your app. SmartThings provides a decent list of icons that can be used as a starting point. It easily allows you to replace the ugly default icon and select a more appropriate one.
Thanks to Brian Steere (@Dianoga SmartThings Community) there is a useful icon explorer that allows you to browse some example icons as used by SmartThings: SmartThings Shared Icons
In order to use any of the icons for your SmartApp simple browse the collection and copy/paste the link into your app. The Icons displayed are the larger 2x sizes.
Thermostat Example:
https://s3.amazonaws.com/smartthings-device-icons/Home/home1-icn@2x.png
In order to get the smaller size simply drop the @2x
from the file name:
https://s3.amazonaws.com/smartthings-device-icons/Home/home1-icn.png
Small Thermostat Example:
To host your own icons and images simply add them to your github repository and reference them through the raw image url like this:
https://raw.githubusercontent.com/fxstein/smartthings-smartlib/master/smartlib@2x.png
https://raw.githubusercontent.com/fxstein/smartthings-smartlib/master/smartlib.png
In order to write nicely written Markdown documents there is a great resource available here on github that gives lots of examples of how to structure a Markdown Document (Thanks to @adam-p):
To be continued...