Install & Compatibility
Where this runs
tested against v0.7.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.202s · 55.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 6.2s · import 1.146s · 57MB
51MB installed
● package 51MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Discover
✓ from kasa import Discover
✗ from kasa.discover import Discover
Discover is exposed at the top-level kasa module since v0.4.0
Device
✓ from kasa import Device
✗ from kasa.device import Device
Device is exposed at the top-level kasa module
SmartDevice
✓ from kasa import SmartDevice
✗ from kasa.smart import SmartDevice
SmartDevice is exported from kasa directly
Discover all Kasa/Tapo devices on the network using credentials.
import asyncio
from kasa import Discover, Credentials
async def main():
creds = Credentials(username='email@example.com', password='password123')
devices = await Discover.discover(credentials=creds)
for ip, dev in devices.items():
print(f'{ip}: {dev.alias} ({dev.model})')
asyncio.run(main())
kasa --version
Errors
Common errors & fixes
AttributeError: module 'kasa' has no attribute 'Discover'
Importing from a wrong location or using too old version (<0.4.0).
fixUse `from kasa import Discover` and upgrade python-kasa: `pip install --upgrade python-kasa`.
RuntimeError: asyncio.run() cannot be called from a running event loop
Trying to run async code inside an already running loop (e.g., Jupyter or script already async).
fixUse `await` directly if already in async context, or use `nest_asyncio.apply()` for Jupyter.
kasa.exceptions.SmartDeviceException: Authentication failed
Invalid credentials or Tapo account has two-factor authentication enabled.
fixEnsure credentials are correct and use an app password if 2FA is on. For some devices, use the local IP-based discovery without credentials.
kasa.exceptions.TimeoutError: Timed out
Device not reachable on the network or firewall blocking.
fixVerify device IP and network connectivity. Ensure you are on the same subnet.
Upgrade
Version history
0.10.2latest on PyPI · released Feb 12, 2025
Audit
Dependencies
aiohttprequiredAsynchronous HTTP client for Tapo protocol
cryptographyrequiredEncryption used for Tapo device communication