DEV Community

Fleet Telemetry: Streaming Data from Your Tesla

Patrick Demers on February 24, 2024

Tesla's recent rollout of fleet-telemetry empowers authorized users to seamlessly stream real-time data directly from Tesla vehicles. Let's delve i...
Collapse
 
bre77 profile image
Brett Adams

I was considering writing an article just like this a few hours ago, so glad to see you already have. I got access to Fleet Telemetry this morning and have successfully implemented it on teslemetry.com to send Webhooks or Server Side Events.

Collapse
 
sjhill01 profile image
Steve Hill

So you subscribe on their behalf and post it back out to their provided webhook on each report?

Collapse
 
slashmili profile image
Milad

One question, why do we need to send ca in the body of Send Fleet Telemetry Config?

I'm asking because in practice it means every 3 months that the TLS certificate changes(assuming I'm using let's encrypt) I have to resubmit my whole fleet configs.

Collapse
 
slashmili profile image
Milad

Or is it only needed on the first time when the vehicle is configured?

Collapse
 
patrickdemers6 profile image
Patrick Demers

Theoretically the CA shouldn't change if you generate with the same CA each time. It's probably easiest to self-sign your certificate. I will update the article soon to show how to do this.

Collapse
 
urkman profile image
Stefan Sturm

when editing the config.json I need to fill the content of the full certificate chain file:
"ca": "content of full certificate chain file from previous step"

But the content is multiline code like this:
-----BEGIN CERTIFICATE-----
12345
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
abcde
-----END CERTIFICATE-----

How can I add this multiline code to the config.json?

Collapse
 
urkman profile image
Stefan Sturm

OK, found it. Every line need a \n and then join to one line...

Now I can use the check script but it gives me:

The server certificate has a valid partial chain, and may work with the root chain.

What can be the problem here?

Collapse
 
patrickdemers6 profile image
Patrick Demers

Looks like verification is passing with -partial_chain flag. From openssl docs:

Allow verification to succeed if an incomplete chain can be built. That is, a chain ending in a certificate that normally would not be trusted (because it has no matching positive trust attributes and is not self-signed) but is an element of the trust store. This certificate may be self-issued or belong to an intermediate CA.

Collapse
 
vbarrier profile image
Vincent Barrier • Edited

Hi Patrick, thank you for this tutorial. I helps a lot! I still have some questions?

=> My app domain is registered like www.your-domain.com not with a classic your-domain.com (newbie error), will it work to have : telemetry.your-domain.com? (certificate has been generated properly)

=> I have sent a CSR to tesla for your-domain.com, I got a response 200 with :

"response": {
"account_id": "4625141***",
"domain": "www.*****.com",
"name": "***",
"description": "***",
"csr": null,
"client_id": "****",
"ca": null,
"created_at": "2023-10-25T17:17:48.744Z",
"updated_at": "2023-11-17T23:14:46.079Z",
"enterprise_tier": "free",
"issuer": null,
"csr_updated_at": null,
"public_key": "0451016f6299****"
}

But I see null for CA and CSR. Do you think that the CSR will be processed? Should I do something else?

Thank you!

Collapse
 
sjhill01 profile image
Steve Hill

Yes, that will work. I'm using "tesla.mydomain.com" for my app registration and "telemetry.mydomain.com" for the fleet-telemetry server and it seems ok with that. Granted I can't get my certs to load correctly yet so I can't prove it...

Collapse
 
bts profile image
bts • Edited

Strange, the telemetry-config has been synced to the car, my server is running, the CSR-request was accepted by Tesla, check_server_cert states 'The server certificate is valid.', but I do not get any data... If I query the Fleet Telemetry Errors endpoint with my partner bearer token, I get an empty fleet_telemetry_errors return...

Collapse
 
bts profile image
bts

Ok, seems like I missed only one step. Although I think the README.md on the github page did not described it a week ago. You need to redirect the owner of the vehicle you want to install the virtual key on to tesla.com/_ak/your-domain.com and let the owner accept this with his app... After doing this last step, data began streaming into my server.

Collapse
 
patrickdemers6 profile image
Patrick Demers

I updated the readme to make the steps clearer a while back. I'll update this post as well.

Collapse
 
bts profile image
bts

the impacted VINs will begin trying to send data shortly

How long is shortly? Just to have an idea. I've sent the config to a MY 2023 model, which accepted it. When requesting its config, the 'synced' field remains 'false'. Even after > 1 hour and waking up de tesla and even driving it for 2 minutes...

Collapse
 
bts profile image
bts

ok, the vehicle now states 'synced'='true'. I guess it may take a while...

Collapse
 
patrickdemers6 profile image
Patrick Demers

Yeah, there's no hard rule on when the vehicle will receive the config. It depends on if it's connected to the server, has a solid internet connection, etc.

Collapse
 
blizzfire profile image
Patrick

Hello and thanks for this great post!
May I ask you how long it took for Tesla to get back to you after you submitted the CSR?
In step 9 of their fleet api Github repo they mention it may take up to two weeks
github.com/teslamotors/fleet-telem...

Have you contacted them via email or just waited for them to get back to you?

Collapse
 
vbarrier profile image
Vincent Barrier

Did they get back to you?

I'm still waiting since 2024-03-31

Collapse
 
sjhill01 profile image
Steve Hill

It took more than the advertised 2 weeks for me - just got my response this week and probably submitted it around the same time you did.

Thread Thread
 
vbarrier profile image
Vincent Barrier

Thank you Steve, There were a problem on my account CSR was not attached but it is fixed!

Collapse
 
sjhill01 profile image
Steve Hill

Is there any information out there about rate/data limits? I swear I had seen some at one point, and maybe I'm just blind and am missing it, but I know if I try to be too aggressive it tells me, but what can I get away with?

Collapse
 
patrickdemers6 profile image
Patrick Demers

More info about rate limits and billing plans is slated for later this quarter or early Q3.

Collapse
 
sjhill01 profile image
Steve Hill

In your example telemetry server config you have "path to certificate from previous step" but really this is some path expected inside the container, isn't it?

Collapse
 
patrickdemers6 profile image
Patrick Demers

Yes, you need to make sure the path is accurate however you're running the fleet-telemetry server. If you're running it using Docker, make sure the path corresponds with the mounted volume.