Teslemetry allows you to configure Tesla Fleet Telemetry for each supported vehicle. This data can be accessed using Server Sent Events (SSE) or Webhooks.
Telemetry button on a vehicleStart / Update StreamingEvery time you make a change, you will need to click Start / Update Streaming to send the new configuration to your vehicle.
Fleet Telemetry is the modern way to access data from Tesla vehicles, but there are a number of limitations imposed by Tesla:
Teslemetry also enforces some limitations on a field by field basis to avoid extraordinary cost. These limits are shown as validation errors on the console and enforced by the API servers. The limits and defaults can be viewed at api.teslemetry.com/fields.json.
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.
The three formats available are:
{
"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..."
}
{
"data": {
"Location": {
"latitude": 30.2226645,
"longitude": -97.6213806
},
"VehicleSpeed": "34.797"
},
"createdAt": "2024-02-24T04:58:44.983607402Z",
"vin": "LRW3..."
}
{
"time": 1708737795.9836073,
"host": "us-west.teslemetry.com",
"source": "LRW3...",
"event": {
"Location": {
"latitude": 30.2226645,
"longitude": -97.6213806
},
"VehicleSpeed": "34.797"
}
}
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 --header "Authorization: Bearer {token}" 'https://{region}.teslemetry.com/sse/{vin}'
https://{region}.teslemetry.com/sse/{vin}?token={token}
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())