In February, we showed you how to automate a light based on your Zoom status with an Endpoint SmartApp. This month, let’s look at how to do this using a Schema Device.
We will be creating a Schema SmartApp to automatically build a cloud connected device with custom capabilities. This will represent our meeting status and allow Rules to react to updates.
Account Prerequisites
AWS Serverless Account
AWS IAM Credentials
Samsung Account
Zoom Developer Account
Software Prerequisites
Install Serverless CLI
npm -g install serverless
Install SmartThings CLI
npm -g install @smartthings/cli
Clone example repo
git clone https://github.com/SmartThingsDevelopers/zoom-connect.git
Preparation
Custom Capabilities
Follow instructions here:
The custom capability files can be found in the definitions folder of the project.
Use the information obtained from your Serverless account and update serverless.yml
org: your-serverless-org-here
service: your-serverless-service-name
Use the information obtained from the developer Workspace and update serverless.yml
myEnvironment:
DEVICE_PROFILE_ID:
dev: your-device-profile-id
Ensure that the AWS IAM ID and SECRET are stored and accessible to the environment you are working on. Enter the following command in the terminal while inside the folder of the project.
You can either use a certificate or set these at run time. On Mac/Linux you can use
$ export AWS_ACCESS_KEY_ID=YOUR_ID_HERE
$ export AWS_SECRET_ACCESS_KEY=YOUR_KEY_HERE
Once everything is configured properly, run the deploy command.
$ serverless deploy --stage dev --region us-east-1
Provide permission to SmartThings
Next, you will need to grant SmartThings permission to execute this Lambda function. There are two ways you can grant permissions; only one method is required.
Register your Lambda function with SmartThings
Before you register your SmartApp, make a note of the ARN for your Lambda function. You can find the ARN of your Lambda function from the Lambda function page on your AWS console. Read more about ARNs on Amazon’s documentation.
In the Developer Workspace create a SmartApp using AWS Lambda and Serverless
https://smartthings.developer.samsung.com/workspace/projects/new
Zoom Oauth Registration
Note your APP ID, Client ID, and Client Secret
Create a user level OAuth App using the Zoom Developer’s portal.
-
On the App Credentials screen enter SmartThings for “Redirect URL for OAuth”
-
Features Page: Enable event subscriptions, select presence event types, and subscribe to user presence events.
Finish the wizard and head back to your code editor.
We will make some changes to the environment variables here
[code block]
Re-run the deploy command for the Serverless app.
$ serverless deploy --stage dev --region us-east-1
Once complete, you should have the SmartApp ready to deploy to test. With Developer Mode enabled the new application will be present under “My Apps” in the SmartThings mobile client.