ESP32 firmware that connects directly to a Tesla Powerwall 3 gateway over its local Wi‑Fi and broadcasts key stats via BTHome BLE for easy Home Assistant discovery. Built for LilyGO TTGO T‑Display (ESP32), but easily portable to other ESP32 boards.
The Tesla TEDAPI runs on a local gateway and isn't documented. It uses GraphQL / signed protobufs over HTTP.
Wouldn't have been possible without all of the R&D done over at https://github.com/jasonacox/pypowerwall
- Target board: LilyGO TTGO T‑Display (ESP32)
- Display: Onboard ST7789 240x135 TFT (rendered battery and power stats)
- BLE: NimBLE (BTHome v2, unencrypted)
-
Install tooling
- VS Code + PlatformIO extension
-
Configure gateway Wi‑Fi credentials
- Rename
src/config.h.templatetosrc/config.h - Edit the file and set your Powerwall 3 gateway Wi‑Fi SSID and password:
POWERWALL_WIFI_SSID→ typically looks likeTeslaPW_XXXXXXPOWERWALL_WIFI_PASSWORD→ printed on the gateway/inside the door
- Note:
src/config.his already ignored by git.
- Rename
-
Build and upload
- Board:
env:lilygo-t-displayinplatformio.ini - Click “Upload” in PlatformIO, or run
PlatformIO: Upload - Open Serial Monitor at 115200 to view logs
- Board:
- Connects to the Powerwall gateway Wi‑Fi and queries TEDAPI locally (no cloud).
- Renders a simple battery/power view on the TFT display.
- Advertises a BTHome v2 BLE payload named
PW BTHomefor passive discovery.
- Protocol: BTHome v2, unencrypted, service UUID
0xFCD2 - Advertised entities (Home Assistant will discover these):
- Battery percent (0–100)
- Solar power (W)
- Load power (W)
- Site power (W) — grid import (+) / export (−) as reported
- Battery power (W)
- The BLE advertisement contains battery percent followed by four power values in a fixed order: solar, load, site, battery. The payload is broadcast about once per second.
- The ESP32 must be in range of the Powerwall gateway’s Wi‑Fi. It connects only to that SSID and does not require internet.
- Update
platformio.inipins/display settings as needed, or stub outdisplay.*if running headless. - BLE and Powerwall logic are board‑agnostic; the main changes are GPIO/display config.
- Not connecting: double‑check SSID/password in
src/config.h, and ensure you’re near the gateway. - No BLE in HA: enable the BTHome integration and ensure your HA host supports passive BLE; bring the ESP32 closer.
MIT — see LICENSE for details.