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

Smartthings SmartApp send downstream cloud message with Google Firebase

smartthings-logo-horizontal.b229e786

  1. Follow instruction at Smartthings to create and configure the SmartApp.
  2. Follow the document to subscribe the things event. An example at github shows a sample code snippet of a working SmartApp – provides a HTTP GET API interface to list all the available things and the data.
  3. Also, follow the Firebase document to setup the client device SDK and note down the client device token, and the firebase server key.
  4. Write an event data handler to process the event and send downstream message by http POST. Sample code can be seen below.