Skip to main content

Async Tesla Powerwall 3 client over the TEDAPI v1r RSA-signed LAN protocol.

Project description

aiopowerwall

An async Tesla Powerwall 3 client built on aiohttp, written for Home Assistant and any other asyncio code.

Status

Beta (0.x). The wire protocol and the public Python API may change between minor versions until 1.0. Pin a tight version range if you depend on this library in production.

This library speaks the Powerwall's TEDAPI v1r protocol — RSA-signed protobuf messages directly to your Powerwall. It is intentionally scoped to:

  • Powerwall 3, and updated Powerwall 2 (untested)
  • Local LAN access only (no cloud telemetry)
  • Read + control commands (status, config, firmware, components, max-backup)

The RSA key pair used for v1r authentication must be registered with the gateway out-of-band, typically via the Tesla Fleet API. This library consumes an already-paired private key — it does not implement registration.

Install

pip install aiopowerwall

Quick start

import asyncio
from pathlib import Path
from aiopowerwall import PowerwallClient

async def main() -> None:
    pem = Path("tedapi_rsa_private.pem").read_bytes()
    async with PowerwallClient(
        host="192.168.91.1",
        gateway_password="<gateway-password>",
        rsa_private_key_pem=pem,
    ) as pw:
        await pw.connect()
        print("DIN:", pw.din)
        print("Battery SoC:", await pw.get_battery_soe(), "%")
        print("Grid:", await pw.get_grid_status())
        print("Power:", await pw.current_power())

asyncio.run(main())

API surface

Method Returns
connect() DIN string
get_din() DIN string
get_config() config.json (dict)
get_status() DeviceController query (narrow)
get_device_controller() DeviceController query (extended)
get_components() Powerwall 3 component data
get_firmware_version(details=...) Version string or details dict
get_meters_aggregates() /api/meters/aggregates
get_battery_soe() Battery SoC percentage
get_grid_status() Grid status string
battery_level() SoC computed from status payload
current_power(location=...) Real power per meter aggregate
backup_time_remaining() Hours of backup at current load
write_config(updates) Patch config.json (dotted paths)
schedule_max_backup(seconds) Schedule manual backup event
cancel_max_backup() Cancel manual backup event
get_backup_events() Active and scheduled backup events

All read methods cache responses with a configurable TTL (cache_status_ttl, cache_config_ttl); pass force=True to refresh.

Exceptions

All errors are subclasses of PowerwallError:

  • PowerwallConnectionError — transport failure / timeout
  • PowerwallAuthenticationError — bad password or unregistered RSA key
  • PowerwallRateLimitError — gateway returned 429/503
  • PowerwallFaultError — signed-message fault (key inactive, expired, etc.)
  • PowerwallProtocolError — malformed response

Acknowledgements

This project builds on the protocol research and reference implementation in pypowerwall by Jason Cox, distributed under the MIT License. Huge thanks to Jason and the pypowerwall contributors for reverse-engineering and documenting the TEDAPI protocol.

License

MIT (see LICENSE). Original pypowerwall copyright and license notice are retained in LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiopowerwall-0.1.0.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiopowerwall-0.1.0-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file aiopowerwall-0.1.0.tar.gz.

File metadata

  • Download URL: aiopowerwall-0.1.0.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aiopowerwall-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35658e22d8f4d6fe1c380060d2c6642e057a1bdd60ac94064425ea58f2417382
MD5 73fe9bfa786fa1e69dccc7fa83d2d7f8
BLAKE2b-256 dbf8f4f9eaa572a139ed05477182d4da7d325037a8b46d2dbf012d82fb56fbe2

See more details on using hashes here.

File details

Details for the file aiopowerwall-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aiopowerwall-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aiopowerwall-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e526a454eb8e1ed48a9168246731d7fd18766cb6b6ef3a940d2ef81e88b19e00
MD5 1953685c56a00ed78967db813f060b85
BLAKE2b-256 b294fa4a971ee4c94b77aad34ff1911f5787ca654bffd67005241b830051c7ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page