Skip to main content

aiopytedapi

An async Python client for the Tesla Powerwall gateway's local TEDAPI.

  • Async only, built on aiohttp. You pass in the ClientSession, so it fits Home Assistant and other asyncio apps.
  • Typed (py.typed, checked with mypy --strict).
  • Local: talks to the gateway on your network. Nothing goes to Tesla's servers.
  • Errors are exceptions, never None: every one derives from TedapiError.

Status: alpha (0.x). The API may change between minor versions. Pin aiopytedapi>=0.1,<0.2.

Connections

Connection Endpoint Authenticates with Can change settings
Signed /tedapi/v1r on the gateway's home-network address or its Wi-Fi address (192.168.91.1) An RSA key registered with the gateway Yes
Gateway Wi-Fi /tedapi/v1 on 192.168.91.1 The Wi-Fi password printed on the gateway No (read-only)

Registering a key needs Tesla's cloud once (for example python -m pypowerwall register). This library doesn't do that step.

Features

Feature Methods Signed Gateway Wi-Fi
Network status (Wi-Fi, Ethernet, cellular) get_network_status() ✅ Powerwall 3 ✅ Powerwall 3 and 2
Site import/export limits get_site_limits(), set_import_limit(), set_export_limit() ✅ read and write ✅ read
Battery calibration delay get_battery_calibration_delay_status(), delay_battery_calibration() ✅ —
Registered keys get_authorized_clients(), add_authorized_client(), remove_authorized_client() ✅ list, add, remove ✅ list
Gateway configuration get_config() ✅ ✅
Battery inventory (Powerwalls, expansion packs) get_battery_inventory(), BatteryInventory.from_payloads() ✅ ✅

What has been seen on hardware so far:

  • Network status: Powerwall 3 (firmware 26.34.3) on both connections; Powerwall 2 (26.42.0) on Gateway Wi-Fi only. Over the signed connection a Powerwall 2 answers MessageFaultError (MESSAGEFAULT_ERROR_TIMEOUT).
  • Registered keys: listing, adding and removing on a Powerwall 3 (26.34.3).
  • Site limits: reading on a Powerwall 3 (26.34.3). Writing has not been tried on hardware.
  • Battery inventory: built from config.json plus the component readings you pass in (keyed by each Powerwall's DIN); this library doesn't read components itself yet. Tested against recorded payload shapes only.
  • Calibration delay: a Powerwall 3 on 26.34.3 answers NotSupportedError (the firmware doesn't implement it). The delay command has not been sent to hardware.

Example

import asyncio
from pathlib import Path

import aiohttp

from aiopytedapi import RsaKey, TedapiClient


async def main() -> None:
    key = RsaKey.from_pem(Path("tedapi_rsa_private.pem").read_bytes())
    async with aiohttp.ClientSession() as session:
        client = TedapiClient.signed(session, "192.168.1.50", key, password="ABCDE")
        await client.connect()

        status = await client.get_network_status()
        print(status.active, status.to_dict())

        limits = await client.get_site_limits()
        print(limits.import_limit_kw, limits.export_limit_kw)

        for c in (await client.get_authorized_clients()).clients:
            print(c.fingerprint[:16], c.type, c.state)


asyncio.run(main())

password is the customer login password (the last 5 characters of the Gateway Wi-Fi password on most gateways). It's used to fetch the DIN. Pass din= instead if you already know it.

For the Gateway Wi-Fi connection:

client = TedapiClient.wifi(session, "WIFI_PASSWORD")

Safety

Some commands change how your Powerwall and your site behave.

  • Site limits: an installer may have set the import or export limit to meet your grid connection agreement (for example a network export limit). Don't raise or remove one unless you're allowed to.
  • Calibration delay: the gateway allows a limited number of delays, and each may use one.
  • Removing a key stops that client sending commands. Removing the key you sign with is refused unless you pass allow_current_key=True.

Every command that changes something logs a WARNING. You use these commands at your own risk; check your warranty and your grid connection agreement first.

Privacy

Models keep values that identify a home or a person (Wi-Fi SSID, MAC and IP addresses, key descriptions, DINs and serial numbers) out of repr, and to_dict() only includes them with details=True. The gateway's Wi-Fi password is never parsed. get_config() returns the gateway's full configuration, which includes identifiers: don't log or publish it.

Credits

The wire schema and the request formats come from pypowerwall (MIT), which in turn credits Matthew1471's Tesla-API, Nexarian's TEDAPI work and Teslemetry/tesla-protocol. See NOTICE.

This project is not affiliated with or endorsed by Tesla.

Development

pip install -e . pytest pytest-asyncio pytest-cov mypy ruff types-protobuf
ruff check . && mypy && pytest --cov

The protobuf bindings are generated: change src/aiopytedapi/_proto/tedapi.proto, then run bash tools/gen_proto.sh. Never edit tedapi_pb2.py by hand.

Licence

MIT. See LICENSE.

Metadata

Release files for aiopytedapi 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiopytedapi 0.2.0
File Size Uploaded Provenance Actions
aiopytedapi-0.2.0.tar.gz 54.8 kB With provenance Details for aiopytedapi-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiopytedapi 0.2.0
File Interpreter ABI Platform Actions
aiopytedapi-0.2.0-py3-none-any.whl Python 3 none any Details for aiopytedapi-0.2.0-py3-none-any.whl

Total release size: 104.0 kB

Release files / aiopytedapi-0.2.0.tar.gz

Download URL aiopytedapi-0.2.0.tar.gz
Size 54.8 kB
Tags Source
SHA-256 checksum
How to use checksums
558b4fc83ca17b57ba0c4c5bab20e7872654299514a68f106c61d54d02c0c235
BLAKE2b-256 checksum
How to use checksums
d246d16630434b208943774c2f8f87773fbac8f994d1b7e2ee4020c67a2db71d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / aiopytedapi-0.2.0-py3-none-any.whl

Download URL aiopytedapi-0.2.0-py3-none-any.whl
Size 49.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
666a85c6454c6cc3bf78e9be8ae1f1573eb92a68b6456448993126074cc0036b
BLAKE2b-256 checksum
How to use checksums
77c00bec9614d4b6342e5f9e6f6630ab80bf321ada9205e092fd36eb301c44b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for aiopytedapi 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiopytedapi-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page