# Local Interaction with Tesla via ESPHome BLE
> [! note]-
> The content of this page is generated by audio/video transcription and text transformation from the content and links of this source.
Source: [https://fosdem.org/2025/schedule/event/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome/](https://fosdem.org/2025/schedule/event/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome/)
<video src="https://video.fosdem.org/2025/h1302/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome.av1.webm" controls></video>
## Summary & Highlights:
The session explores how Yasir Ekinci interacts with Tesla vehicles locally over Bluetooth Low Energy (BLE) using ESPHome and ESP32.
**Introduction to the Problem**
In early 2024, Tesla introduced strict API rate limits, reducing the number of commands to just 50 per day. This disrupted smart charging automations, which were sending thousands of commands daily. To overcome this, Yasir re-implemented Tesla's vehicle protocol in C++ for the ESP32 microcontroller, enabling local control of Tesla vehicles by acting as a BLE vehicle key.
**Technical Implementation**
The talk provides an overview of Tesla's vehicle protocol and dives into BLE communication using an ESP32. This involves practical ESPHome implementations for common vehicle controls. The result is a cost-effective, open-source solution operating entirely locally with sub-second response times, eliminating the need for internet or API tokens.
**Challenges and Solutions**
Yasir discusses the challenges of using ESP32, such as limited memory and processing power, and how these were addressed. The session also covers the use of NanoPB for encoding messages and the implementation of a queue system to handle message chunks effectively.
**Practical Applications**
The session highlights practical applications, including dynamic charging, load balancing, and overload protection using home assistant. The solution allows for efficient use of solar energy and adapts to local energy tariffs, making it highly relevant for eco-social transformation.
## Importance for an eco-social transformation
This session is significant for eco-social transformation as it showcases a sustainable approach to vehicle management by reducing reliance on cloud services and promoting local control. The use of ESP32 and ESPHome offers a low-cost, energy-efficient solution that can be adapted for other smart home applications. Eco-social designers can leverage these open-source tools to develop systems that optimize energy use and support renewable energy integration. Challenges include ensuring security and handling the technical limitations of low-power devices, while opportunities exist in expanding this approach to other electric vehicles and smart home systems.
## Slides:
| | |
| --- | --- |
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_001.jpg\|300]] | The session introduces the concept of interacting with Tesla vehicles locally using Bluetooth Low Energy (BLE) and ESPHome, presented by Yasir Ekinci. The key focus is on creating a local, internet-free solution for vehicle control, leveraging open-source repositories available on GitHub.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_002.jpg\|300]] | Dynamic charging with Home Assistant is explored, highlighting features such as solar excess charging, battery boost, load balancing, overload protection, off-peak charging, and capacity tariff limits. The system updates every 10 seconds, allowing for up to 8,640 vehicle commands per day, showcasing its efficiency and responsiveness.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_003.jpg\|300]] | The session discusses the limitations of relying on cloud services due to Tesla's API rate limits, which restrict requests to 50 per day compared to the previous 8,640. This prompted the search for local solutions to maintain smart charging capabilities.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_004.jpg\|300]] | The feasibility of local operation without internet or rate limits is examined. ESP32 is chosen for its low cost, low power consumption, and small size, making it ideal for proximity to the car. However, challenges include limited memory and processing power, as well as the complexity of using ESPHome with custom C++.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_005.jpg\|300]] | Tesla's open-source vehicle-command protocol, written in Golang, is introduced as a starting point for local control solutions. This offers a foundation for developing C++ implementations for ESP32, promoting open-source collaboration.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_006.jpg\|300]] | Tesla's Vehicle Protocol includes two subsystems: Vehicle Security (VCSEC) and Infotainment. VCSEC manages locks and simple data requests, while Infotainment handles commands like charging and heating. Each domain requires separate handshakes and session states due to distinct public keys.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_007.jpg\|300]] | The ESPHome pairing process is explained, allowing the ESP32 device to function as a BLE vehicle key. This setup enables local control of Tesla vehicles, offering a secure and efficient alternative to cloud-based solutions.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_008.jpg\|300]] | The Tesla Vehicle Protocol uses a UniversalMessage format, encoded in protobuf. This efficient binary format allows for precise encoding and decoding of messages, facilitating seamless communication between the ESP32 device and the vehicle.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_009.jpg\|300]] | The structure of a UniversalMessage is detailed, including destination identifiers, payloads, and signature data. This format ensures secure and reliable communication with Tesla's infotainment system, enabling complex commands like charging limit adjustments.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_010.jpg\|300]] | ESP BLE's gattc_event_handler is introduced, managing connection events and data notifications. The system handles incoming data in chunks and uses APIs to send data, ensuring robust communication with Tesla vehicles.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_011.jpg\|300]] | A message queuing system is implemented to manage the flow of data, accommodating the chunked nature of BLE communications. This approach enhances reliability and efficiency in handling vehicle commands.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_012.jpg\|300]] | The command state machine is described, detailing the process for executing commands like changing charging amps. It includes steps for waking the car, updating session information, and handling retries to ensure successful communication.
| ![[FOSDEM 2025/assets/Interacting-with-Tesla-vehicles-locally-over-BLE-u/preview_013.jpg\|300]] | For further exploration, links to GitHub repositories are provided, offering resources for those interested in implementing or expanding upon the solutions presented in the session.
## Links
[Presentation slides](https://fosdem.org/2025/events/attachments/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome/slides/238177/20250201_ZQpnYZm.pdf)
[C++ library repo](https://github.com/yoziru/tesla-ble)
[ESPHome project repo](https://github.com/yoziru/esphome-tesla-ble)
[Video recording (AV1/WebM)](https://video.fosdem.org/2025/h1302/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome.av1.webm)
[Video recording (MP4)](https://video.fosdem.org/2025/h1302/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome.av1.mp4)
[Video recording subtitle file (VTT)](https://video.fosdem.org/2025/h1302/fosdem-2025-4664-interacting-with-tesla-vehicles-locally-over-ble-using-esphome.vtt)
[Chat room(web)](https://fosdem.org/2025/chat/room/h1302)
[Chat room(app)](https://fosdem.org/2025/chat/app/h1302)