{"id":13585704,"url":"https://github.com/python-kasa/python-kasa","last_synced_at":"2025-05-15T00:04:26.284Z","repository":{"id":37627613,"uuid":"221571611","full_name":"python-kasa/python-kasa","owner":"python-kasa","description":"🏠🤖 Python API for TP-Link smarthome products","archived":false,"fork":false,"pushed_at":"2025-03-04T07:16:48.000Z","size":4824,"stargazers_count":1392,"open_issues_count":66,"forks_count":221,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-07T23:36:20.263Z","etag":null,"topics":["asyncio","kasa","python","smarthome","tapo","tplink"],"latest_commit_sha":null,"homepage":"https://python-kasa.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-kasa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORTED.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["rytilahti"]}},"created_at":"2019-11-13T23:34:19.000Z","updated_at":"2025-05-07T10:21:25.000Z","dependencies_parsed_at":"2023-10-05T04:37:02.731Z","dependency_job_id":"77ef8b0e-9c43-4a67-838c-d047d20d9640","html_url":"https://github.com/python-kasa/python-kasa","commit_stats":{"total_commits":982,"total_committers":75,"mean_commits":"13.093333333333334","dds":0.5814663951120163,"last_synced_commit":"47934dbf966eb8feb55a72f3a0560132c542e7a4"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-kasa%2Fpython-kasa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-kasa%2Fpython-kasa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-kasa%2Fpython-kasa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-kasa%2Fpython-kasa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-kasa","download_url":"https://codeload.github.com/python-kasa/python-kasa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249199,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","kasa","python","smarthome","tapo","tplink"],"created_at":"2024-08-01T15:05:05.808Z","updated_at":"2025-05-15T00:04:26.041Z","avatar_url":"https://github.com/python-kasa.png","language":"Python","readme":"# python-kasa\n\n[![PyPI version](https://badge.fury.io/py/python-kasa.svg)](https://badge.fury.io/py/python-kasa)\n[![Build Status](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml/badge.svg)](https://github.com/python-kasa/python-kasa/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/python-kasa/python-kasa/branch/master/graph/badge.svg?token=5K7rtN5OmS)](https://codecov.io/gh/python-kasa/python-kasa)\n[![Documentation Status](https://readthedocs.org/projects/python-kasa/badge/?version=latest)](https://python-kasa.readthedocs.io/en/latest/?badge=latest)\n\npython-kasa is a Python library to control TPLink's smart home devices (plugs, wall switches, power strips, and bulbs).\n\nThis is a voluntary, community-driven effort and is not affiliated, sponsored, or endorsed by TPLink.\n\n**Contributions in any form (adding missing features, reporting issues, fixing or triaging existing ones, improving the documentation, or device donations) are more than welcome!**\n\n---\n\n## Getting started\n\nYou can install the most recent release using pip:\n```\npip install python-kasa\n```\n\nAlternatively, you can clone this repository and use `uv` to install the development version:\n```\ngit clone https://github.com/python-kasa/python-kasa.git\ncd python-kasa/\nuv sync --all-extras\nuv run kasa\n```\n\nIf you have not yet provisioned your device, [you can do so using the cli tool](https://python-kasa.readthedocs.io/en/latest/cli.html#provisioning).\n\n## Discovering devices\n\nRunning `kasa discover` will send discovery packets to the default broadcast address (`255.255.255.255`) to discover supported devices.\nIf your device requires authentication to control it,\nyou need to pass the credentials using `--username` and `--password` options or define `KASA_USERNAME` and `KASA_PASSWORD` environment variables.\n\n\u003e [!NOTE]\n\u003e If your system has multiple network interfaces, you can specify the broadcast address using the `--target` option.\n\nThe `discover` command will automatically execute the `state` command on all the discovered devices:\n\n```\n$ kasa discover\nDiscovering devices on 255.255.255.255 for 3 seconds\n\n== Bulb McBulby - L530 ==\nHost: 192.0.2.123\nPort: 80\nDevice state: False\nTime:         2024-06-22 15:42:15+02:00 (tz: {'timezone': 'CEST'}\nHardware:     3.0\nSoftware:     1.1.6 Build 240130 Rel.173828\nMAC (rssi):   5C:E9:31:aa:bb:cc (-50)\n== Primary features ==\nState (state): False\nBrightness (brightness): 11 (range: 0-100)\nColor temperature (color_temperature): 0 (range: 2500-6500)\nLight effect (light_effect): *Off* Party Relax\n\n== Information ==\nSignal Level (signal_level): 2\nOverheated (overheated): False\nCloud connection (cloud_connection): False\nUpdate available (update_available): None\nDevice time (device_time): 2024-06-22 15:42:15+02:00\n\n== Configuration ==\nHSV (hsv): HSV(hue=35, saturation=70, value=11)\nAuto update enabled (auto_update_enabled): False\nLight preset (light_preset): *Not set* Light preset 1 Light preset 2 Light preset 3 Light preset 4 Light preset 5 Light preset 6 Light preset 7\nSmooth transition on (smooth_transition_on): 2 (range: 0-60)\nSmooth transition off (smooth_transition_off): 20 (range: 0-60)\n\n== Debug ==\nDevice ID (device_id): soneuniqueidentifier\nRSSI (rssi): -50 dBm\nSSID (ssid): HomeNet\nCurrent firmware version (current_firmware_version): 1.1.6 Build 240130 Rel.173828\nAvailable firmware version (available_firmware_version): None\n```\n\n\n## Command line usage\n\nAll devices support a variety of common commands (like `on`, `off`, and `state`).\nThe syntax to control device is `kasa --host \u003chost\u003e \u003ccommand\u003e`:\n\n```\n$ kasa --host 192.0.2.123 on\n```\n\nUse `kasa --help` ([or consult the documentation](https://python-kasa.readthedocs.io/en/latest/cli.html#kasa-help)) to get a list of all available commands and options.\nSome examples of available options include JSON output (`--json`), more verbose output (`--verbose`), and defining timeouts (`--timeout` and `--discovery-timeout`).\nRefer [the documentation](https://python-kasa.readthedocs.io/en/latest/cli.html) for more details.\n\n\u003e [!NOTE]\n\u003e Each individual command may also have additional options, which are shown when called with the `--help` option.\n\n\n### Feature interface\n\nAll devices are also controllable through a generic feature-based interface.\nThe available features differ from device to device and are accessible using `kasa feature` command:\n\n```\n$ kasa --host 192.0.2.123 feature\n== Primary features ==\nState (state): False\nBrightness (brightness): 11 (range: 0-100)\nColor temperature (color_temperature): 0 (range: 2500-6500)\nLight effect (light_effect): *Off* Party Relax\n\n== Information ==\nSignal Level (signal_level): 2\nOverheated (overheated): False\nCloud connection (cloud_connection): False\nUpdate available (update_available): None\nDevice time (device_time): 2024-06-22 15:39:44+02:00\n\n== Configuration ==\nHSV (hsv): HSV(hue=35, saturation=70, value=11)\nAuto update enabled (auto_update_enabled): False\nLight preset (light_preset): *Not set* Light preset 1 Light preset 2 Light preset 3 Light preset 4 Light preset 5 Light preset 6 Light preset 7\nSmooth transition on (smooth_transition_on): 2 (range: 0-60)\nSmooth transition off (smooth_transition_off): 20 (range: 0-60)\n\n== Debug ==\nDevice ID (device_id): soneuniqueidentifier\nRSSI (rssi): -50 dBm\nSSID (ssid): HomeNet\nCurrent firmware version (current_firmware_version): 1.1.6 Build 240130 Rel.173828\nAvailable firmware version (available_firmware_version): None\n```\n\nSome features present configuration that can be changed:\n```\nkasa --host 192.0.2.123 feature color_temperature 2500\nChanging color_temperature from 0 to 2500\nNew state: 2500\n```\n\n\u003e [!NOTE]\n\u003e When controlling hub-connected devices, you need to pass the device ID of the connected device as an option: `kasa --host 192.0.2.200 feature --child someuniqueidentifier target_temperature 21`\n\n\n## Library usage\n\n```\nimport asyncio\nfrom kasa import Discover\n\nasync def main():\n    dev = await Discover.discover_single(\"192.0.2.123\", username=\"un@example.com\", password=\"pw\")\n    await dev.turn_on()\n    await dev.update()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\nIf you want to use this library in your own project, a good starting point is [the tutorial in the documentation](https://python-kasa.readthedocs.io/en/latest/tutorial.html).\n\nYou can find several code examples in the API documentation [How to guides](https://python-kasa.readthedocs.io/en/latest/guides.html).\n\nInformation about the library design and the way the devices work can be found in the [topics section](https://python-kasa.readthedocs.io/en/latest/topics.html).\n\n## Contributing\n\nContributions are very welcome! The easiest way to contribute is by [creating a fixture file](https://python-kasa.readthedocs.io/en/latest/contribute.html#contributing-fixture-files) for the automated test suite if your device hardware and firmware version is not currently listed as supported.\nPlease refer to [our contributing guidelines](https://python-kasa.readthedocs.io/en/latest/contribute.html).\n\n## Supported devices\n\nThe following devices have been tested and confirmed as working. If your device is unlisted but working, please consider [contributing a fixture file](https://python-kasa.readthedocs.io/en/latest/contribute.html#contributing-fixture-files).\n\n\u003e [!NOTE]\n\u003e The hub attached Tapo buttons S200B and S200D do not currently support alerting when the button is pressed.\n\n\u003e [!NOTE]\n\u003e Some firmware versions of Tapo Cameras will not authenticate unless you enable \"Tapo Lab\" \u003e \"Third-Party Compatibility\" in the native Tapo app.\n\u003e Alternatively, you can factory reset and then prevent the device from accessing the internet.\n\n\u003c!--Do not edit text inside the SUPPORTED section below --\u003e\n\u003c!--SUPPORTED_START--\u003e\n### Supported Kasa devices\n\n- **Plugs**: EP10, EP25[^1], HS100[^2], HS103, HS105, HS110, KP100, KP105, KP115, KP125, KP125M[^1], KP401\n- **Power Strips**: EP40, EP40M[^1], HS107, HS300, KP200, KP303, KP400\n- **Wall Switches**: ES20M, HS200[^2], HS210, HS220[^2], KP405, KS200, KS200M, KS205[^1], KS220, KS220M, KS225[^1], KS230, KS240[^1]\n- **Bulbs**: KL110, KL120, KL125, KL130, KL135, KL50, KL60, LB100, LB110\n- **Light Strips**: KL400L5, KL420L5, KL430\n- **Hubs**: KH100[^1]\n- **Hub-Connected Devices[^3]**: KE100[^1]\n\n### Supported Tapo[^1] devices\n\n- **Plugs**: P100, P110, P110M, P115, P125M, P135, TP15\n- **Power Strips**: P210M, P300, P304M, P306, TP25\n- **Wall Switches**: S210, S220, S500D, S505, S505D\n- **Bulbs**: L510B, L510E, L530B, L530E, L630\n- **Light Strips**: L900-10, L900-5, L920-5, L930-5\n- **Cameras**: C100, C110, C210, C220, C225, C325WB, C520WS, C720, TC65, TC70\n- **Doorbells and chimes**: D100C, D130, D230\n- **Vacuums**: RV20 Max Plus, RV30 Max\n- **Hubs**: H100, H200\n- **Hub-Connected Devices[^3]**: S200B, S200D, T100, T110, T300, T310, T315\n\n\u003c!--SUPPORTED_END--\u003e\n[^1]: Model requires authentication\n[^2]: Newer versions require authentication\n[^3]: Devices may work across TAPO/KASA branded hubs\n\nSee [supported devices in our documentation](SUPPORTED.md) for more detailed information about tested hardware and software versions.\n\n## Resources\n\n### Developer Resources\n\n* [softScheck's github contains lot of information and wireshark dissector](https://github.com/softScheck/tplink-smartplug)\n* [TP-Link Smart Home Device Simulator](https://github.com/plasticrake/tplink-smarthome-simulator)\n* [Unofficial API documentation](https://github.com/plasticrake/tplink-smarthome-api)\n* [Another unofficial API documentation](https://github.com/whitslack/kasa)\n* [pyHS100](https://github.com/GadgetReactor/pyHS100) provides synchronous interface and is the unmaintained predecessor of this library.\n\n\n### Library Users\n\n* [Home Assistant](https://www.home-assistant.io/integrations/tplink/)\n* [MQTT access to TP-Link devices, using python-kasa](https://github.com/flavio-fernandes/mqtt2kasa)\n* [Homebridge Kasa Python Plug-In](https://github.com/ZeliardM/homebridge-kasa-python)\n\n### Other related projects\n\n* [PyTapo - Python library for communication with Tapo Cameras](https://github.com/JurajNyiri/pytapo)\n  * [Home Assistant integration](https://github.com/JurajNyiri/HomeAssistant-Tapo-Control)\n* [Tapo P100 (Tapo plugs, Tapo bulbs)](https://github.com/fishbigger/TapoP100)\n  * [Home Assistant integration](https://github.com/fishbigger/HomeAssistant-Tapo-P100-Control)\n* [plugp100, another tapo library](https://github.com/petretiandrea/plugp100)\n  * [Home Assistant integration](https://github.com/petretiandrea/home-assistant-tapo-p100)\n* [rust and python implementation for tapo devices](https://github.com/mihai-dinculescu/tapo/)\n","funding_links":["https://github.com/sponsors/rytilahti"],"categories":["hacktoberfest","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-kasa%2Fpython-kasa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-kasa%2Fpython-kasa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-kasa%2Fpython-kasa/lists"}