Skip to main content

Wrapper for python-kasa to connect with cloud devices.

Reason this release was yanked:

Too many bugs

Project description

PyKasaCloud

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 has not been tested extensively as I only have access to "iot" protocol devices and I'm not sure if other devices utilize passthrough mechanism via the cloud api.

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.auth(username="username", password="password")

You can then get a dictionary of devices. The deviceId in the cloud will be the keys and the values will be kasa.Devices.

devices: dict[str, Device] = cloud.getDevices()

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.auth(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.auth( 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:

def token_update_callback(config_entry: ConfigEntry) -> Callable:
    def updated_token(token: Token) -> None:
        config_entry["token"] <- token
    return update_token

token = Token(**config_entry.get("token"))
cloud: KasaCloud = await KasaCloud.auth(token=token, token_update_callback = token_update_callback(config_entry))

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

pykasacloud-2025.7.10.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

pykasacloud-2025.7.10-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pykasacloud-2025.7.10.tar.gz.

File metadata

  • Download URL: pykasacloud-2025.7.10.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pykasacloud-2025.7.10.tar.gz
Algorithm Hash digest
SHA256 928c39ba55eb1fd55adf5fd611ec5d0b367eff81e8b64a869419fb243b0d2ada
MD5 9166fbf3ee9bbd43adb3a10bb5385841
BLAKE2b-256 9f2f37124080b96ef908a9abc82bbf9b63758f3b2d0d4d3f46c28328eaca53cb

See more details on using hashes here.

File details

Details for the file pykasacloud-2025.7.10-py3-none-any.whl.

File metadata

File hashes

Hashes for pykasacloud-2025.7.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f9ab3cabc25e7df0c2c765cfd2182fc8bdbacb1dd845fa7841f4cf324ee35776
MD5 212dee7f88d9aaddf172b6c322bfb419
BLAKE2b-256 042632de1fbf2fdc099661fb5b5e68c1d726a960c5d403d003da2623172dcca1

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