node-red-contrib-tesla-fleet-api

Read your Tesla's State of Charge into Node-RED via the official Tesla Fleet API — read-only, your own developer app, no paid third-party service, never wakes the car.

What you'll need

A Tesla account and about 10 minutes. Everything else happens by clicking — there is no terminal involved.

Setup

1 Generate your key

In Node-RED, drop in a Tesla single metric node and open its config. Under Onboarding click Generate key pair, then Copy public key. (The private key is not used for read-only — you can download it as a backup or forget it.)

2 Upload the public key

Go to fleetkey.cc, paste your public key, and it gives you a domain like xxxxx.fleetkey.net. Tesla will read your key from there. Copy that domain and save it in a notepad for the next steps — you'll need it in two places.

3 Create your Tesla developer app

Go to developer.tesla.com, sign in, and create a Fleet API Application. The wizard has four steps:

Application Details

  • Application Name — anything you like, but it must not contain the word “Tesla” (the form rejects those). E.g. My EV Dashboard or Home Car Reader.
  • Application Description — e.g. Reads my own vehicle data into Node-RED home automation.
  • Purpose of Usage — e.g. Personal home automation: read-only access to my car’s state of charge and other metrics in Node-RED. No commands.

Client Details

Choose grant type “Authorization Code and Machine-to-Machine”, then fill the three URL fields (this is where people get stuck, so here is exactly what goes where):

Field in the Tesla formWhat to enter
Allowed Origin URL(s) Your fleetkey domain from step 2:
https://xxxxx.fleetkey.net
(the domain hosting your public key)
Allowed Redirect URI(s) https://teslametrics.github.io/node-red-contrib-tesla-fleet-api/callback.html
(where Tesla returns the login code)
Allowed Returned URL(s) (optional) Leave empty.

API & Scopes

Tick only what read-only needs:

  • Vehicle Informationrequired. This is the read access to your car’s live data that the whole package relies on.
  • Vehicle Locationoptional, only if you want latitude / longitude / heading. Pair it with the Include location option in Node-RED (step 4).
  • Leave Profile Information, Vehicle Commands, Vehicle Charging Management and both Energy Product scopes unchecked — read-only never uses them.

Billing Details (optional)

Click Skip and Submit. No card needed; Tesla includes a free monthly Fleet API credit and a 15-minute poll stays well within it.

After approval (usually quick, sometimes a few days) you get a Client ID and Client Secret.

4 Finish onboarding in Node-RED

Back in the node's config, fill in Key Domain (your fleetkey domain), Client Secret and the Redirect URI (the callback URL above). Then:

This registers your app with Tesla and stores a refresh token in the node.

Changing scopes after you already authorised once? Tesla may skip the consent screen and keep the old permissions, so the new scope never takes effect. First revoke the app at accounts.tesla.com → Security → Third-Party Apps, then generate the login link again — Tesla will re-prompt and grant the new scope.

5 Deploy

Click Done, then Deploy. The node now polls your State of Charge. Its badge shows e.g. online 48%; msg.payload carries the battery level.

Reading metrics

After onboarding, drop one of two metric nodes onto your flow:

Wire either node to a Debug node and click Deploy. All metric nodes share the config's single refresh poll, so adding more nodes does not cause extra Tesla API calls. When the car is asleep or offline, the node emits the last-known value with msg.stale = true and never wakes the car.

If your Tesla account has more than one car, each node has a Vehicle picker (it appears after you pair the account and Deploy the config). On a single-car account it auto-selects your only car. The config only polls the cars a node actually reads.

Cost & privacy

Reading runs on your own Tesla developer app, so your data goes straight from Tesla to your Node-RED — nothing passes through us or fleetkey (which only hosts a public key). Tesla gives each account a free monthly Fleet API credit; a 15-minute poll stays well within it, and the node never wakes the car.