This example allows you to test a Lambda SmartApp without requiring any physical devices. It can also be invoked locally using Serverless CLI without requiring any accounts or deployments.
Test locally using serverless invoke local by passing in example SmartThings event payload data. This will enable you to exercise the various event handlers in the SmartApp without needing to deploy the changes.
First, npm install
to pull in serverless.
npx serverless invoke local -f smartapp -p payloads/install.json
npx serverless invoke local -f smartapp -p payloads/schedule.json
See payloads for more event data that conforms to the SmartThings SmartApp API.
- An AWS account (free tier is fine).
- A Samsung account and the SmartThings mobile application.
- A Developer Workspace account.
-
Install the dependencies for this app:
npm install
. -
Follow the instructions to setup AWS credentials for serverless.
-
Deploy the Lambda function:
npx serverless deploy
. -
Follow the steps to grant SmartThings permission to execute your Lambda function. This is required for successful registration.
Follow the instructions for registering a SmartApp with the SmartThings platform.
- The following OAuth2 scopes are required.
r:locations:*
Follow the instructions for testing a SmartApp.
Once installed, the app should schedule itself to say hello every minute.