A simple HTTP server sending commands controlling your Tesla's charging process via BLE.
-
Generate private key:
openssl ecparam -genkey -name prime256v1 -noout > private.pem -
Generate public key:
openssl ec -in private.pem -pubout > public.pem -
Start container using Docker Compose:
services: tesla-ble: image: ghcr.io/virtualzone/tesla-ble:latest container_name: tesla-ble restart: always volumes: - './private.pem:/app/private.pem' - './public.pem:/app/public.pem' - '/var/run/dbus:/var/run/dbus' - '/run/dbus:/run/dbus:ro' privileged: true network_mode: host cap_add: - NET_ADMIN - SYS_ADMIN
-
Get into your car, have your key card ready, call the following endpoint to send a BLE pairing request to your Tesla and follow the instructions on screen (replace VEHICLE_VIN with your vehicle's VIN):
curl -X POST localhost:8080/api/1/vehicles/VEHICLE_VIN/command/pair -
After successful paring, you can use the endpoints listed below.
curl -X POST \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/pair
curl -X POST \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/wakeup
curl -X POST \
-d '{"charging_amps": "16"}' \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/set_charging_amps
curl -X POST \
-d '{"soc_limit": "70"}' \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/set_soc_limit
curl -X POST \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/charge_start
curl -X POST \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/charge_stop
curl -X POST \
-d '{"enable": "true"}' \
http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/charge
vehicles:
- name: tesla
type: custom
title: Model Y
capacity: 78
wakeup:
source: http
uri: "http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/wake_up"
method: POST
body: ''
maxcurrent:
source: http
uri: "http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/set_charging_amps"
method: POST
body: '{"charging_amps": "{{.maxcurrent}}"}'
chargeenable:
source: http
uri: "http://localhost:8080/api/1/vehicles/VEHICLE_VIN/command/charge"
method: POST
body: '{"enable": "{{.chargeenable}}"}'