Skip to main content

PyKasaCloud

PyPI - Version

This is a library wrapper that allows you to connect to some TPLink/Kasa/Tapo devices via the cloud utilizing the excellent python-kasa library. Essentially this adds a transport and protocol class to facilitate this. This appears to only work on "iot" protocol (legacy) devices rather than "smart" protocol devices (tapo and some newer kasa devices).

This library was written to support the TPLink Cloud Integration.

Usage

Rather than use discovery like python-kasa you must get connect to the cloud (providing credentials) to obtain a token.

cloud: KasaCloud = await KasaCloud.kasacloud(username="username", password="password")

You can then get a list of device dictionaries which you can then use to get a kasa.Device:

devices: list[DeviceDict] = cloud.get_device_list()
device: Device = cloud.get_device(devices[0])

You can then interact with these devices like python-kasa devices.

Caching tokens

To cache tokens to a json file, provide a path.

cloud: KasaCloud = await KasaCloud.kasacloud(username="username", password="password", token_storage_file=".kasacloud.json")

Subsequent authenication can be accomplished just using the token_storage_file parameter.

cloud: KasaCloud = await KasaCloud.kasacloud( token_storage_file=".kasacloud.json")

Refesh Token and Callbacks

If you are storing the token externally, say in a HomeAssistant Config Entry simply pass a Token object (inside async_setup_entry in __init__.py of a given integration)

async def update_token(token: Token) -> None:
    data = entry.data | {TOKEN: token}
    result = hass.config_entries.async_update_entry(
        entry=entry, data=data, unique_id=entry.unique_id
    )
    if not result:
        raise TokenUpdateError("Unable to update token in config entry")

    try:
        cloud: KasaCloud = await KasaCloud.kasacloud(
            token=entry.data.get(TOKEN), token_update_callback=update_token
        )
    except AuthenticationError as err:
        raise ConfigEntryAuthFailed(err) from err

Metadata

Release files for pykasacloud 2025.10.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 pykasacloud 2025.10.1
File Size Uploaded
pykasacloud-2025.10.1.tar.gz 7.3 kB Details

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / pykasacloud-2025.10.1.tar.gz

Download URL pykasacloud-2025.10.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67c3b369f5a36a64ba86cbd7385bd6cd6138650acdf83ecd18e1b9823155a74d
BLAKE2b-256 checksum
How to use checksums
cae4fe5cb170980ef5ca4c5b40c9ffff2c46d5830577c2aa71fe2aa75d882f83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / pykasacloud-2025.10.1-py3-none-any.whl

Download URL pykasacloud-2025.10.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
633ca9dba3f7182f8144b6f31247694a5bcb0cde8e0aec999d4ef41a7a4a0ed1
BLAKE2b-256 checksum
How to use checksums
971964053ca06589295eae4287e3feac0e89b2a3c57e21c99b8a2be954aec507
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

2025.10.1 This release

2 release files

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