Talking to a tesla over bluetooth
limited functionality
- tags
- tesla
- bluetooth
Contents
We are working on an Apple Watch app for the Tesla, and I'm experimenting with talking to the car directly over bluetooth. It works albiet with some severe limitations.
What you can do:
- turn climate on and off
- set climate temp (not read)
- set all the seat heaters and steering wheel
- honk
- flash lights
- open/close trunk
- open frunk
- vent and close windows
- lock, unlock
- turn on keyless driving
- get body controller state
- set charging level
- set charging schedule
- set precondition schedule
What you can't do
- getting battery level
- reading temperature settings
- is the climate currently on?
- is the car charging?
Lets get going!
Env variables
We are going to setup some environment variables to make it easier to pass in command line options.
If you use the FleetAPI or the old Rest API, you can get the vehicle information automatically, but for this you need to know the VIN before hand. You can get this from the settings on your app, or I guess look in the window.
|
|
Create the keys with tesla-keygen
:
|
|
|
|
This will generate and put the private key in your keyring. It'll also print out the public_key, which you need for a few things.
|
|
Setting up tesla-control
|
|
Now, bring your laptop to the car, and run:
|
|
Put the keycard in the center console to activate.
Commands
body-controller-state
gets returns what's going on with the car. This
is all you can really get over BLE at this time.
|
|
This will return all of the keys setup in the vehicle:
|
|
You need to wake up the car before you can unlock it.
|
|
Important stuff, though I do use this when in the airport parking lot after a bit of a trip.
|
|
Climate controls:
|
|
|
|
|
|
charging-schedule and precondition not tested
ble
We'll need the private key that's stored in the system key ring:
|
|
Lets write some bluetooth go code! The logic here is that we want to unlock the car, and in order to do that the car needs to be awake, so we fix check to see its sleep status and wake it up as needed, and then unlock it as needed.
Run like:
|
|
|
|
Previously