Skip to main content

python-tapo-local

Client for TP-Link Tapo cameras built from reverse engineering the official Tapo Android app (3.22.304). It talks to the camera on the local network using the same methods and payloads as the app, and it can optionally use the TP-Link cloud (app API v2) for push notifications.

It powers the Tapo Local Home Assistant integration.

pip install python-tapo-local

Local

from tapolocal import TapoLocal

cam = TapoLocal("192.168.1.50", "<TP-Link account password>")  # login: admin + cloud password
info = cam.device_info()  # model, firmware, MAC, alias
data = cam.fetch()        # ~44 getters + 24h detection history + today's recordings
cam.call("setLedStatus", {"led": {"config": {"enabled": "off"}}})
  • Transport comes from pytapo (securePassthrough). On top of it, this library adds the app's method catalog and request shapes.
  • Requests are batched through multipleRequest. Methods the firmware doesn't support (-40209) are skipped.
  • Login is attempted at most twice per call. Every wrong password counts toward the camera's 30‑minute lockout, so TapoAuthError is raised and it never loops. A session the camera has invalidated (-40214 on a C200 v3, -40401) is replaced by one fresh login and the call is repeated. Other camera error codes keep the session.
  • Writes use set<X> {module: {section: {field: value}}}, the same shape as the matching getter. Some C200 quirks: setDayNightModeConfig requires "chn_id": ["1"], setFirmwareAutoUpgradeConfig requires time and random_range, brightness is only accepted through setImageLumaConfig, and the siren only takes the legacy {"method": "do", "msg_alarm": {"manual_msg_alarm": …}} (see TapoLocal.legacy).
  • tapolocal.EVENT_TYPES maps every alarm_type from the app's PlayBackEventType enum.

Cloud (optional)

import aiohttp
from tapolocal import TapoCloud, TapoMFARequired

async with aiohttp.ClientSession() as s:
    cloud = TapoCloud(s, "you@example.com", "password")
    try:
        await cloud.login()
    except TapoMFARequired as mfa:
        await cloud.send_mfa_email()
        await cloud.check_mfa(mfa.process_id, input("code: "))
    cameras = await cloud.devices()
    notes = await cloud.notifications(hours=24)
  • Requests are signed exactly like the app's m7/r interceptor: X-Authorization: Timestamp=9999999999, Nonce=…, AccessKey=…, Signature=HMAC-SHA1(...).
  • getAppNotificationByPage only returns data with direction: "asc" starting at indexTime. getDeviceMsgsByPage exists in the API, but the app never calls it and it always comes back empty.
  • TLS is verified against the two TP-Link root CAs that the app itself bundles.

Development

uv run --with pytest --with pytest-asyncio --with-editable . pytest

Metadata

Release files for python-tapo-local 0.1.1

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

Source distribution (sdist)

Source distribution for python-tapo-local 0.1.1
File Size Uploaded Provenance Actions
python_tapo_local-0.1.1.tar.gz 12.1 kB Without provenance Details for python_tapo_local-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-tapo-local 0.1.1
File Interpreter ABI Platform Actions
python_tapo_local-0.1.1-py3-none-any.whl Python 3 none any Details for python_tapo_local-0.1.1-py3-none-any.whl

Total release size: 24.0 kB

Release files / python_tapo_local-0.1.1.tar.gz

Download URL python_tapo_local-0.1.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e238269ea0c114e23a81b4778108b45542d10370505abd223e3a24cecee3354b
BLAKE2b-256 checksum
How to use checksums
25b940e2922192796ddc89aedbaba3ec24832bf66c87626fc175c25d9bd39623
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / python_tapo_local-0.1.1-py3-none-any.whl

Download URL python_tapo_local-0.1.1-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
458ac4ab5e4922c1cfa75676b1a8d96b6db68e5cf808fc698f788413cc645027
BLAKE2b-256 checksum
How to use checksums
e114acf335259c64fb02bb15787bfd1b3f6e4842f0048bb5b51104fef777550e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Security for python-tapo-local 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.1.1 This release

2 release files No 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