{"id":24449,"library":"python-kasa","title":"python-kasa","description":"Python API for TP-Link Kasa and Tapo smart home devices. Version 0.10.2 supports bulbs, plugs, switches, hubs, cameras, robot vacuums, and more. Active development with frequent releases.","status":"active","version":"0.10.2","language":"python","source_language":"en","source_url":"https://github.com/python-kasa/python-kasa","tags":["kasa","tapo","tplink","smarthome","iot","async"],"install":[{"cmd":"pip install python-kasa","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Asynchronous HTTP client for Tapo protocol","package":"aiohttp","optional":false},{"reason":"Encryption used for Tapo device communication","package":"cryptography","optional":false}],"imports":[{"note":"Discover is exposed at the top-level kasa module since v0.4.0","wrong":"from kasa.discover import Discover","symbol":"Discover","correct":"from kasa import Discover"},{"note":"Device is exposed at the top-level kasa module","wrong":"from kasa.device import Device","symbol":"Device","correct":"from kasa import Device"},{"note":"SmartDevice is exported from kasa directly","wrong":"from kasa.smart import SmartDevice","symbol":"SmartDevice","correct":"from kasa import SmartDevice"}],"quickstart":{"code":"import asyncio\nfrom kasa import Discover, Credentials\n\nasync def main():\n    creds = Credentials(username='email@example.com', password='password123')\n    devices = await Discover.discover(credentials=creds)\n    for ip, dev in devices.items():\n        print(f'{ip}: {dev.alias} ({dev.model})')\n\nasyncio.run(main())","lang":"python","description":"Discover all Kasa/Tapo devices on the network using credentials."},"warnings":[{"fix":"Upgrade Python to 3.11 or later.","message":"Python 3.11 is now required (requires_python >=3.11). Python 3.9 and 3.10 no longer supported.","severity":"breaking","affected_versions":">=0.10.0"},{"fix":"Pass a `Credentials` object with email and password to `Discover.discover()`.","message":"Tapo cloud credentials are required for newer Tapo devices (Tapo protocol). Old Kasa devices may also need credentials depending on firmware. `Discover.discover()` with no credentials will find fewer devices.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Wrap code in `async def main(): ... asyncio.run(main())`.","message":"Asynchronous API: all methods are async. You must use `asyncio.run()` or await inside an async context.","severity":"gotcha","affected_versions":"all"},{"fix":"Import from `kasa` directly: `from kasa import SmartDevice`.","message":"Direct import from `kasa.smart` or `kasa.iot` submodules is discouraged. Use top-level `kasa.SmartDevice` or `kasa.IotDevice` instead.","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"Upgrade to >=0.8.1.","message":"Device update may fail if a child device (e.g., plug on a hub) reports unsupported data. Ensure you run the latest version.","severity":"gotcha","affected_versions":"<0.8.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from kasa import Discover` and upgrade python-kasa: `pip install --upgrade python-kasa`.","cause":"Importing from a wrong location or using too old version (<0.4.0).","error":"AttributeError: module 'kasa' has no attribute 'Discover'"},{"fix":"Use `await` directly if already in async context, or use `nest_asyncio.apply()` for Jupyter.","cause":"Trying to run async code inside an already running loop (e.g., Jupyter or script already async).","error":"RuntimeError: asyncio.run() cannot be called from a running event loop"},{"fix":"Ensure credentials are correct and use an app password if 2FA is on. For some devices, use the local IP-based discovery without credentials.","cause":"Invalid credentials or Tapo account has two-factor authentication enabled.","error":"kasa.exceptions.SmartDeviceException: Authentication failed"},{"fix":"Verify device IP and network connectivity. Ensure you are on the same subnet.","cause":"Device not reachable on the network or firewall blocking.","error":"kasa.exceptions.TimeoutError: Timed out"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}