{"id":15178570,"url":"https://github.com/smartthingscommunity/smartapp-sdk-java","last_synced_at":"2025-10-01T19:30:39.145Z","repository":{"id":34315540,"uuid":"167418760","full_name":"SmartThingsCommunity/smartapp-sdk-java","owner":"SmartThingsCommunity","description":"A collection of consumer-oriented Java (JVM) libraries for creating SmartApps and using the public API","archived":true,"fork":false,"pushed_at":"2022-02-03T15:35:15.000Z","size":822,"stargazers_count":51,"open_issues_count":4,"forks_count":46,"subscribers_count":91,"default_branch":"master","last_synced_at":"2024-09-28T15:05:32.063Z","etag":null,"topics":["groovy","java","kotlin","smartapp","smartthings","smartthings-api","smartthings-smartapp"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartThingsCommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-24T18:47:48.000Z","updated_at":"2024-09-07T15:00:28.000Z","dependencies_parsed_at":"2022-08-08T00:16:05.629Z","dependency_job_id":null,"html_url":"https://github.com/SmartThingsCommunity/smartapp-sdk-java","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartThingsCommunity","download_url":"https://codeload.github.com/SmartThingsCommunity/smartapp-sdk-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234892715,"owners_count":18902907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["groovy","java","kotlin","smartapp","smartthings","smartthings-api","smartthings-smartapp"],"created_at":"2024-09-27T15:05:33.283Z","updated_at":"2025-10-01T19:30:38.727Z","avatar_url":"https://github.com/SmartThingsCommunity.png","language":"Java","readme":"# Archived\n\n\u003e This SDK is no longer being maintained and should not be chosen for new projects.\n\n# SmartThings SmartApp SDK Java (Preview) ![SmartThings](docs/smartthings-logo.png) ![Java](docs/java-logo.png)\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://search.maven.org/search?q=g:%22com.smartthings.sdk%22\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/com.smartthings.sdk/smartapp-core.svg?label=Maven%20Central\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://circleci.com/gh/SmartThingsCommunity/smartapp-sdk-java/tree/master\"\u003e\u003cimg src=\"https://circleci.com/gh/SmartThingsCommunity/smartapp-sdk-java/tree/master.svg?style=svg\u0026circle-token=21da1691c64a0b734e55ada5d591b477347a2936\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/SmartThingsCommunity/smartapp-sdk-java\"\u003e\u003cimg src=\"https://codecov.io/gh/SmartThingsCommunity/smartapp-sdk-java/branch/master/graph/badge.svg?token=Zy5sgPRzLd\"\u003e\u003c/a\u003e\n\u003ca href=\"https://snyk.io/test/github/SmartThingsCommunity/smartapp-sdk-java\"\u003e\u003cimg src=\"https://snyk.io/test/github/SmartThingsCommunity/smartapp-sdk-java/badge.svg\" alt=\"Known Vulnerabilities\" data-canonical-src=\"https://snyk.io/test/github/SmartThingsCommunity/smartapp-sdk-java\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://smartthingsdev.slack.com/messages/CG8D8PS6B\"\u003e\u003cimg src=\"https://badgen.net/badge//smartthingsdev?icon=slack\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003e **Welcome!**  This SDK is currently in _**preview**_ and is not recommended for use in production applications at this time. We welcome your bug reports, feature requests, and contributions.\n\n## Getting Started\n\nThis SDK includes a set of JVM libraries for building Webhook and AWS Lambda SmartApps, and interacting with the public SmartThings API.\n\n### Prerequisites\n\n* Java 1.8+\n* A Samsung account\n\n### What is a SmartApp?\n\nSmartApps are custom applications that execute outside of the SmartThings Platform. All of the SmartApp execution will happen on the server or Lambda that you control. The complexity of execution and the number of expected users will need to be examined to understand the hardware or execution requirements your app needs to handle. Your application will respond to lifecycle events sent from SmartThings to perform actions on behalf of your users and will execute any scheduled tasks that you have created in the SmartApp. Creating a SmartApp allows you to control and get status notifications from SmartThings devices using the [SmartThings API](https://developer-preview.smartthings.com/api/public#section/Overview).\n\n\u003e Visit the [SmartThings developer documentation](https://developer-preview.smartthings.com/docs/connected-services/smartapp-basics) to earn more about SmartApps.\n\n### Hosting Your SmartApp\n\nThere are two distinct options for hosting your SmartApp: AWS Lambda and Webhook.\n\n**Webhook** SmartApps are any publicly-accessible web server that will receive a POST request payload.\n\n**AWS Lambda** SmartApps are hosted in the Amazon Web Services cloud and are invoked by **ARN** instead of a public-DNS address.\n\nThe best hosting option for your Automation depends on a number of factors, both objective and subjective.\n\nTo learn more about SmartApps, including [choosing the best hosting option for your SmartApp](https://developer-preview.smartthings.com/docs/connected-services/hosting/choose-a-solution), visit the [SmartThings developer documentation](https://developer-preview.smartthings.comd).\n\n### Declaring Your SmartApp\n\nTake a quick look at how SmartApps are declared in various languages.\n\n\u003cdetails\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\npackage app\n\nval smartApp: SmartApp = SmartApp.of { spec -\u003e\n    spec\n        .configuration(Configuration())\n        .install {\n            Response.ok(InstallResponseData())\n        }\n        .update {\n            Response.ok(UpdateResponseData())\n        }\n        .event {\n            Response.ok(EventResponseData())\n        }\n        .uninstall {\n            Response.ok(UninstallResponseData())\n        }\n}\n\nfun Application.main() {\n    install(Routing) {\n        post(\"/smartapp\") {\n            call.respond(smartApp.execute(call.receive()))\n        }\n    }\n}\n\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\n    SmartApp smartApp = SmartApp.of { spec -\u003e\n        spec\n            .install({ req -\u003e\n                // create subscriptions\n                Response.ok()\n            })\n            .update({ req -\u003e\n                // delete subscriptions\n                // create subscriptions\n                Response.ok()\n            })\n            .configuration({ req -\u003e\n                ConfigurationResponseData data = ...// build config\n                Response.ok(data)\n            })\n            .event(EventHandler.of { eventSpec -\u003e\n                eventSpec\n                    .onSubscription(\"switch\", { event -\u003e\n                       // do something\n                    })\n                    .onSchedule(\"nightly\", { event -\u003e\n                       // do something\n                    })\n                    .onEvent(\n                        { event -\u003e\n                            // test event\n                            true\n                        },\n                        { event -\u003e\n                            // do something\n                        }\n                    )\n            })\n    }\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eJava\u003c/summary\u003e\n\n```java\n    private final SmartApp smartApp = SmartApp.of(spec -\u003e\n        spec\n            .install(request -\u003e {\n                return Response.ok();\n            })\n            .update(request -\u003e {\n                return Response.ok(UpdateResponseData.newInstance());\n            })\n            .configuration(request -\u003e {\n                return Response.ok(ConfigurationReponseData.newInstance());\n            })\n            .event(request -\u003e {\n                EventData eventData = request.getEventData();\n                EventHandler.of(eventSpec -\u003e\n                        eventSpec\n                                .onEvent(event -\u003e {\n                                    // when this predicate is true...\n                                    return true;\n                                }, event -\u003e {\n                                    // ...do something with event\n                                })\n                                .onSchedule(\"nightly\", event -\u003e {\n                                    // do something\n                                })\n                                .onSubscription(\"switch\", event -\u003e {\n                                    // do something\n                                })\n                );\n                return Response.ok(EventResponseData.newInstance());\n            })\n        );\n```\n\n\u003c/details\u003e\n\n## Modules and Extension Libraries\n\n### Modules\n\n- The [smartapp-core](/smartapp-core) module provides the core SmartApp framework, enabling you to define a SmartApp that can be used in many different environments including AWS Lambda, Dropwizard, Ratpack, and more.\n\n- The [smartthings-client](/smartthings-client) module is an API library that provides useful utilities for working with the Subscription, Schedules, and Device APIs.\n\n### Extension Libraries\n\n- The [smartapp-guice](/smartapp-guice) extension library provides support for building a SmartApp with Guice dependency injection.\n\n- The [smartapp-spring](/smartapp-spring) extension library provides support for building a SmartApp with Spring dependency injection.\n\n- The [smartapp-contextstore-dynamodb](/smartapp-contextstore-dynamodb) extension library implements a [context store](smartapp-core/README.md#context-store) using DynamoDB.\n\n## Adding the SDK to your build\n\nSeveral artifacts are published to the Maven central repository under the `com.smartthings.sdk` group.\n\n* `smartapp-core` - Core SmartApp Framework\n  * `smartapp-guice` - Extension library for use with Google Guice\n  * `smartapp-spring` - Extension library for use with Spring Dependency Injection\n  * `smartapp-contextstore-dynamodb` - Extension library to use DynamoDB to\n    store installed application context data.\n* `smartthings-client` - Library for working with SmartThings APIs\n\nImport the library dependencies as needed:\n\n\u003cdetails\u003e\n    \u003csummary\u003eApache Maven\u003c/summary\u003e\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.smartthings.sdk\u003c/groupId\u003e\n  \u003cartifactId\u003esmartapp-core\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.4-PREVIEW\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eGradle Groovy DSL\u003c/summary\u003e\n\n```groovy\nimplementation 'com.smartthings.sdk:smartapp-core:0.0.4-PREVIEW'\n```\n\n\u003c/details\u003e\n\u003cbr\u003e\n\nIf you prefer, the artifacts can be downloaded directly from [Maven Central](https://search.maven.org/search?q=g:com.smarrthings.sdk).\n\n## Examples\n\nSeveral simple, runnable examples of using the SDK are included in the examples directory.\n\n#### [kotlin-smartapp](examples/kotlin-smartapp) ([Documentation](examples/kotlin-smartapp/README.md)) ![kotlin-logo](docs/kotlin-logo.png) ![ktor-logo](docs/ktor-logo.png)\nThis Kotlin example implements the Java `smartapp-core` library with a simple [Ktor](https://ktor.io/) server.\n\n#### [java-ratpack-guice-smartapp](examples/java-ratpack-guice-smartapp) ([Documentation](examples/java-ratpack-guice-smartapp/README.md)) ![java-logo](docs/java-logo.png) ![ratpack-logo](docs/ratpack-logo.png)\nThis Java example implements the Java `smartapp-core` library with a Ratpack server and uses Guice for dependency management.\n\n#### [java-springboot-smartapp](examples/java-springboot-smartapp) ([Documentation](examples/java-springboot-smartapp/README.md)) ![java-logo](docs/java-logo.png) ![spring-logo](docs/spring-logo.png)\nThis Java example implements the Java `smartapp-core` library using Spring Boot.\n\n#### [java-lambda-smartapp](examples/java-lambda-smartapp) ([Documentation](examples/java-lambda-smartapp/README.md)) ![java-logo](docs/java-logo.png) ![aws-logo](docs/aws-logo.png)\nThis Java example implements the Java `smartapp-core` library as an AWS Lambda.\n\n## More about SmartThings\n\nCheck out our complete developer documentation [here](https://developer-preview.smartthings.com).\n\nTo create and manage your services and devices on SmartThings, create an account in the\n[developer workspace](https://devworkspace.developer.samsung.com/).\n\nThe [SmartThings Community](https://community.smartthings.com/c/developers/) is a good place share and\nask questions.\n\nThere is also a [SmartThings reddit community](https://www.reddit.com/r/SmartThings/) where you\ncan read and share information.\n\n## License and Copyright\n\nLicensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\nCopyright 2019 SmartThings, Inc.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-sdk-java/lists"}