Rohit007
(Rohit)
March 9, 2021, 6:43am
1
I was trying to integrate Smartthings with AWS lambda and AWS IOT core
Created a AWS lambda in N.Virginia and gave permission to smartthings.
Configured AuthO(also gave samrtthings callback URLs) account for OAuth authentication.
Went to developer workspace and gave the required details.
Also created a device profile.
In the smartthings app (My testing devices) the doesnt even redirect to authO page.It just shows the following error.please help.
nayelyz
(SmartThings Developer Support)
March 9, 2021, 9:05pm
3
Welcome, @Rohit007 ! There are a couple of things I’d like to confirm:
You’re working with an ST Schema integration
Does your OAuth server receive the request from SmartThings when you select the device?
Rohit007
(Rohit)
March 10, 2021, 3:22am
4
Yes I am using cloud connector.I am using authO for authentication control. And has no problem from authO side.
nayelyz
(SmartThings Developer Support)
March 10, 2021, 5:24pm
5
Ok, so, since the Authentication flow doesn’t seem to initialize. Take a look at the OAuth servers of the samples below. They have been tested and the OAuth process is successful, within them, you can see the process flow and verify if your integration complies with it.
Creating custom capabilties for schema devices
Using the SmartThings CLI and Developer Workspace
We are going to create a Cloud Connected Device using Schema and webhooks. Our base device will be a basic switch.
The first part of this tutorial will cover create the connector, oAuth server, and adding the Switch to SmartThings. The second part of the tutorial will cover adding a custom capability to this new device.
Prerequisites:
Samsung Account
Developer Workspace Access
Developer Mode Enabled
Glitch Account
Text File
Step 1: Remix this Glitch account (connector)
Set the values in the .env file using .env-example as a guide.
Once the remixed app is up and running copy its URL to your text file.
Register the webhook url in SmartThings Developer Workspace and deploy it for t…
Rohit007
(Rohit)
March 12, 2021, 6:38am
6
I tried with the given OAuth server and AWS lambda. The same Coudnt find device error occured.
But with the given Oauth and Webhook . It started the authentication process.But i got an error even there.(404)
Here are the Oauth logs
nayelyz
(SmartThings Developer Support)
March 12, 2021, 4:11pm
8
Make sure you have the same configuration you put at the Device Cloud Credentials
of the ST Schema connector (Developer Workspace) and the .env
file of the OAuth server (in Glitch)
Those configurations are also printed at the logs, so you can verify if they match:
Rohit007
(Rohit)
March 17, 2021, 6:41am
9
Sorry for late reply.
Yes the OAuth server is working. I am trying with AWS lambda now. And ran into this error
Rohit007
(Rohit)
March 17, 2021, 6:43am
10
Also the authO server has the same config as glitches server but is not redirecting. Then where are things going worng?
nayelyz
(SmartThings Developer Support)
March 19, 2021, 10:50pm
11
Hi, sorry for the delay.
So, this means using a WebHook project, the installation was successful?
Rohit007:
And ran into this error
Ok, to avoid this issue, make sure you:
Have your Lambda function in the correct region (us-east-1
, ap-northeast-1
or eu-west-1
)
You configured correctly your AWS CLI (the correct key and region selected)
You provided the permissions to your Lambda function (using the correct AWS CLI profile and principal
value)
aws lambda add-permission --function-name functionName --profile profileName --principal 148790070172 --statement-id smartthings --action lambda:InvokeFunction
The configuration and code of your Lambda function are correct
a. The project must have the node_modules
> st-schema
directory.
b. In the runtime configuration, you need to see that the handler info matches your file. Eg. if your file is named index.js
, index.handler
it’s correct.