This sample demonstrates a simple Kotlin-based server using Ktor as a web server.
- Java 1.8+
- SmartThings developer account
From the root project directory:
./gradlew examples:kotlin-smartapp:compileJava
./gradlew examples:kotlin-smartapp:run
Note: it is necessary for the application to be running before you create the SmartApp in the developer console. You will need to restart once configured.
Follow these steps using the developer workspace:
- Create a new project and choose "Automation for the SmartThings App".
- Give your project a unique name.
- Choose "Automation Connector | SmartApp" under "Develop" in the left-hand menu.
- Choose "WebHook Endpoint" and enter the URL of your endpoint and click "Next".
- Select the
r:devices:*
andx:devices:*
scopes and click "Next". - Give your application a name and hit "Save". Note that at this point, you will need to have the application running. (See Build and Run above.)
- Save the public key created to a file called
smartthings_rsa.pub
in thesrc/main/resources
directory. - Save the new project and click the "Deploy to Test" button.
- Restart your server (see Build and Run above). (This is necessary because we added the configuration options above.)
First, be sure to enable developer mode in your SmartThings application to see the self-published automation.
Now you should see your SmartApp listed (near the bottom) when you add a new Automation.
If you are not familiar with SmartThings, we have extensive on-line documentation.
To create and manage your services and devices on SmartThings, create an account in the developer workspace.
The SmartThings Community is a good place share and ask questions.
There is also a SmartThings reddit community where you can read and share information.
Licensed under the Apache License, Version 2.0
Copyright 2019 SmartThings, Inc.