Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Latest commit

 

History

History
66 lines (45 loc) · 2.62 KB

File metadata and controls

66 lines (45 loc) · 2.62 KB

kotlin-smartapp kotlin-logo ktor-logo

This sample demonstrates a simple Kotlin-based server using Ktor as a web server.

Running the Example

Build and Run

From the root project directory:

./gradlew examples:kotlin-smartapp:compileJava
./gradlew examples:kotlin-smartapp:run

Create SmartApp

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:

  1. Create a new project and choose "Automation for the SmartThings App".
  2. Give your project a unique name.
  3. Choose "Automation Connector | SmartApp" under "Develop" in the left-hand menu.
  4. Choose "WebHook Endpoint" and enter the URL of your endpoint and click "Next".
  5. Select the r:devices:* and x:devices:* scopes and click "Next".
  6. 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.)
  7. Save the public key created to a file called smartthings_rsa.pub in the src/main/resources directory.
  8. Save the new project and click the "Deploy to Test" button.
  9. Restart your server (see Build and Run above). (This is necessary because we added the configuration options above.)

Install SmartApp

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.

More about SmartThings

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.

License and Copyright

Licensed under the Apache License, Version 2.0

Copyright 2019 SmartThings, Inc.