Getting Started

Telemetry

Using the Tesla Fleet Telemetry

Teslemetry allows you to configure Tesla Fleet Telemetry for each supported vehicle. This data can be accessed using Server Sent Events (SSE) or Webhooks.

Setup

  • Login to the Teslemetry console
  • Follow the instructions to install the virtual key if its missing
  • Click the Telemetry button on a vehicle
  • Select at least one field
  • Click Start / Update Streaming

Every time you make a change, you will need to click Start / Update Streaming to send the new configuration to your vehicle.

Limitations

Fleet Telemetry is a new capability, and there are a number of limitations imposed by Tesla:

  • Requires the Teslemetry virtual key to be installed.
  • Is not supported on pre 2021 Model S/X vehicles with MCU 1 or MCU 2.
  • Can only be active on one third party service at a time.
  • Requires the vehicle to be running version 2023.20 or newer.
  • Is limited to 20 fields total, and 10 values per minute. (This should increase in the future)

Webhooks

Login to the Teslemetry console, and click the "Telemetry" button on a vehicle to config webhooks. You can add up to 10 webhook configurations, which require a URI, predefined format, and optionally an Authorization header. You must configure and start streaming before webhooks will be sent.

The three formats available are:

Tesla / Raw format
{
 "data": [
  {
   "key": "Location",
   "value": {
    "locationValue": {
     "latitude": 30.2226645,
     "longitude": -97.6213806
    }
   }
  },{
   "key": "VehicleSpeed",
   "value": {
    "stringValue": "34.797"
   }
  }
 ],
 "createdAt": "2024-02-24T04:58:44.983607402Z",
 "vin": "LRW3..."
}
Teslemetry format
{
 "data": {
  "Location": {
   "latitude": 30.2226645,
   "longitude": -97.6213806
  },
  "VehicleSpeed": "34.797"
 },
 "createdAt": "2024-02-24T04:58:44.983607402Z",
 "vin": "LRW3..."
}
Splunk format
{
 "time": 1708737795.9836073,
 "host": "us-west.teslemetry.com",
 "source": "LRW3...",
 "event": {
  "Location": {
   "latitude": 30.2226645,
   "longitude": -97.6213806
  },
  "VehicleSpeed": "34.797"
 }
}

Server Sent Events

After streaming has been configured and started, you can stream telemetry events in realtime by connecting with your access token. Optionally include a VIN to listen for a single vehicle, or leave it out to listen to all your vehicles. Server Side Events use the Teslemetry format shown above. Teslemetry provides an open source Python 3 library.

Curl Example
curl --header "Authorization: Bearer {token}" 'https://{region}.teslemetry.com/sse/{vin}'
Browser Example (less secure)
https://{region}.teslemetry.com/sse/{vin}?token={token}
Python Example
import asyncio, aiohttp, teslemetry_stream
async def main():
  async with aiohttp.ClientSession() as session:
    stream = teslemetry_stream.TeslemetryStream(
      access_token="{token}",
      vin="{vin}",
      server="{region}.teslemetry.com",
      session=session,
    )

    async def callback(event):
    print(event)

    asyncio.create_task(stream.listen(callback))

    await asyncio.sleep(60)
    await stream.close()
    
asyncio.run(main())