Chainlink To Help Interact With Tesla Vehicles

53

Chainlink, today, announced the launch of an adapter which allows to control Tesla vehicles. According to an official statement, this external adapter allows interaction with the Tesla, Inc Servers, which are used to interact with Tesla Vehicles and other Tesla products such as Powerwalls. It can also be used to interact with mock servers for testing purposes.

Here is how it works:

This adapter was built as part of the Link My Ride submission to the Chainlink 2020 Virtual Hackathon, and currently supports the following API calls:

  • Vehicle Authentication
  • Vehicle Unlock
  • Vehicle Lock
  • Vehicle Honk Horn
  • Vehicle obtain odometer, charge level & location data

Prerequisites and installation

This implementation stores users’ Tesla API tokens in a Google Firestore database. This is because it needs to support multiple vehicles.

Guide for setting up Firestore in Google Cloud

If only 1 vehicle is to be used, you can modify the adapter to store it in an environment variable

Here are the required environment variables for this external adapter:

Environment variables

VariableDescriptionExample
FIRESTORE_PROJECT_IDRequiredThe Project ID that contains your Google Cloud Firestore serverless DBtesla-firestore-db
FIRESTORE_COLLECTION_NAMERequiredThe collection name of your Google Cloud Firestore serverless DBtelsa-api-tokens
BASE_URLOptionalThe URL of the Tesla API. If left null will default to the Tesla Production Servershttps://owner-api.teslamotors.com/

See Install Locally for a quickstart

Input Params

The structure for the JSON input is as follows. In this example jobSpec is 534ea675a9524e8e834585b00368b178. Actions may be any of the following:

  • authenticate
  • wake_up
  • vehicle_data
  • unlock
  • lock
  • honk_horn