skillfed

python-kasa

Python API for TP-Link Kasa and Tapo devices

python-kasa v0.10.2 194.6K downloads/30d#9,829 on PyPI1,722
Copyleft license GPL-3.0-or-later Active released

What it is and what it does

python-kasa is a community-maintained Python library and CLI tool for discovering and controlling TP-Link Kasa and Tapo smart home devices. It provides both a high-level async API for programmatic control and a command-line interface for direct device management. The library handles device discovery via broadcast, authentication, and feature-based control (turning devices on/off, adjusting brightness, color temperature, and other device-specific settings).

The package is built on async I/O (aiohttp, asyncclick) and supports modern Python versions (3.11+). It works with a wide range of TP-Link hardware including plugs, power strips, wall switches, bulbs, light strips, hubs, and hub-connected devices. The library is not affiliated with TP-Link and relies on community contributions for device support and testing.

Use it for:

  • Automate smart plugs and switches in a home network via Python scripts or scheduled tasks.
  • Build a dashboard or mobile app that discovers and controls multiple TP-Link devices.
  • Integrate TP-Link devices into a broader home automation system (e.g., Home Assistant).
  • Query device state (power, brightness, color) and log telemetry for monitoring.
  • Provision and configure TP-Link devices programmatically before deployment.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Control TP-Link Kasa and Tapo smart home devices (plugs, switches, bulbs, strips, hubs) over the network via Python or command-line interface.

Yes, if you own TP-Link Kasa or Tapo devices and need to control them from Python or the command line. The library is actively maintained, has low install friction, and covers a broad range of device types. The GPL-3.0-or-later license is permissive for personal and open-source use but requires attention if you plan to distribute proprietary software. No known security vulnerabilities.

Install

python-kasa on PyPI

pip

pip install python-kasa

uv

uv add python-kasa

poetry

poetry add python-kasa

Installing python-kasa

Before you install

Low friction: pure Python wheel with 5 runtime dependencies (aiohttp, asyncclick, cryptography, mashumaro, tzdata). Active maintenance with recent commits; last release 548 days ago but repository shows ongoing development.

License in practice

GPL-3.0-or-later (copyleft): you must share modifications under the same license if you distribute derived work. Acceptable for internal use and open-source projects; check your distribution model before embedding.

Quickstart

pip install python-kasa

import asyncio
from kasa import Discover

async def main():
    dev = await Discover.discover_single("192.0.2.123")
    await dev.turn_on()
    await dev.update()

asyncio.run(main())

Requires Python 3.11 or later; devices must be on the same network or reachable by IP address.

Verify before relying

  • Whether authentication (username/password) is required for all device types or only some models.
  • Performance and latency characteristics when controlling many devices simultaneously.
  • Support status for devices not explicitly listed in the documentation.

Package facts

License GPL-3.0-or-later (copyleft)
Python support supports the current Python release (<4.0,>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 5 — aiohttp, asyncclick, cryptography, mashumaro, tzdata
Maintenance actively maintained — 548 days since the last release
Last repo commit
First released
Downloads 194,598/month — #9,829 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_kasa-0.10.2-py3-none-any.whl

License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

tp-link smart home controlkasa device automationtapo smart plug pythonsmart home device apinetwork-connected device controlhome automation librarysmart bulb and switch control
smart-homedevice-controlasync-io

More Networking packages