Automatic to Smartthings, supported by AWS API Gateway + Lambda

“Automatic To Smartthings” is a fully loaded package to have the Automatic OBD2 Adapter integrated with Smartthings.

  • Immediately push every Automatic event update to Smartthings
  • Provide a new device type on Smartthings as a Presence Sensor
  • Display distance, fuel level, battery voltage, MPG and last know parking location
  • Directly integrated, no other resources needed

What do you need?

  • A Smartthings Developer’s account
  • An AWS (Amazon Web Serivce) account
  • An Automatic Developer’s account

Instruction

Smartthings

  • Create a new Device Handler in Smartthings Developer’s website, with the code from DeviceHandler.groovy
  • Create a new device from device list, select type Automatic.
  • Create a new Web Service Smart App at Here with code from SmartApp.groovy, and follow the Smartthings document to create an SmartApp API Endpoint and SmartApp API Token.

AWS Lambda

  • Create an AWS Lambda function, with the code from /AWS_Lambda/index.js, Also remember to setup environment variable ss_apiuri and ss_token in Lambda with the value from above step. Configure the function to be triggered by AWS API Gateway, and make a public access and copy the AWS API Endpoint.
  • Since AWS Lambda does not support npm install a proper node_module folder has to be generated from a local environment, and zip everything up to Lambda.

Automatic

  • Create an App in Automatic developer’s website, setup webhook in Event Delivery part with AWS API Endpoint as Webhook URL. Use “Connect with Automatic Button” option on the same page to connect your Automatic Account with your Automatic App.

How everything works together

  • Automatic Dev App (POST) -> AWS API Gateway -> AWS Lambda (POST) -> Smartthings Smart App -> Smartthings Device Handler

What are…

  • Automatic: The OBD2 car trip, location and health monitor
  • Smartthings: The smart home hub
  • AWS API Gateway: AWS Restful API handler
  • AWS Lambda: The AWS serverless instance

Where to download?

Click-> GitHub_Logo to download

AWS IoT Button: Send POST request to Google Firebase

AWS IoT Button was introduced by Amazon as the developer version of it’s dash button.

The AWS IoT Button allows user to associate with an AWS Lambda instance to run some code snippet while press the button – either play with other AWS service such as Amazon SNS or integrate with your own service.

The button press has 3 types: single, double and long which can be found from the Lambda event.

Here is a simple code gist to demonstrate sending a POST request to Google Firebase client while the button is pressed:

(Keep in mind that AWS Lambda doesn’t have the npm install for your node.js code function – which means you have to upload a zipped file which contains the node.js node_modules folder as dependency)