模板概览

Status Overview of a Tesla Car

AUTOMOBILE, MICS

This visualization obtains and visualizes information directly from a Tesla. Please note that you need a Tesla with the corresponding access data in order to use this template.

Template: Status Overview of a Tesla Car
Open file with Peakboard Designer

Remarks

Please note that this approach uses the same api as the tesla mobile app. This is not an official api.

Request token

In order to get this board running you need to request an api key via the Tesla api. Just send a POST request with the following json body to https://owner-api.teslamotors.com/oauth/token:

{  "grant_type": "password",  "client_id": "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384",  "client_secret": "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3",  "email": "<your email address for tesla.com>",  "password": "<your password for tesla.com>"}

The response will look like this:

{    "access_token": "<your access token>",    "token_type": "bearer",    "expires_in": 3888000,    "refresh_token": "<your refresh token>",    "created_at": 1564730977}

Since the retrieved access token is only valid for 45 days, you can use the request_token to request a new token. You can do this by sending a POST request with the following json body to https://owner-api.teslamotors.com/oauth/token:

The request will look like this:

{  "grant_type": "refresh_token",  "client_id": "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384",  "client_secret": "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3",  "refresh_token": "<your refresh_token>"}

Find your vehicle_id

Now you need to find out about the id of your Tesla (you have to use id instead of vehicleId) by requesting a list of vehicles from https://owner-api.teslamotors.com/api/1/vehicles. To access this endpoint you are required to add the header Authorization: Bearer <your acces_token here> to your request. The response will look like this:

{    "response": [        {            "id": <your id>,            "vehicle_id": <your vehicle_id>,            "vin": "<your vin>",            "display_name": "Friedhelm",            "option_codes": "AD15,MDL3,PBSB,RENA,...",            "color": null,            "tokens": ["<your tokens>"],            "state": "offline",            "in_service": false,            "id_s": "<your id>",            "calendar_enabled": true,            "api_version": 6,            "backseat_token": null,            "backseat_token_updated_at": null        }    ],    "count": 1}

Get vehicle status

Now you can jump into the Peakboard designer. There you have to set the two variables token and vehicleId to the token and id you received in the previous calls (use your id not vehicle_id for vehicleId).

Sometimes it may take up to 20 seconds to finish this request. The reason for that is that the Tesla falls asleep when inactive for a few minutes and needs some time to wake up again.

Related Templates

立即试用Peakboard-Designer!

下载Peakboard-Designer,在最短的时间内为每个部门定制仪表盘。

使用Peakboard-Designer,无论是采用实时图块、语音命令还是经典图表,您都可以快速创建多种仪表盘,实时显示相关信息。方便快捷,一目了然。它可用于生产、仓储物流、IT或是分销部门。

免费下载Peakboard Designer