GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-kasa/docs/source/codeinfo.md at master · python-kasa/python-kasa

Expand file tree

/

codeinfo.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
30 lines (24 loc) · 890 Bytes
/

codeinfo.md

Copy path

File metadata and controls

30 lines (24 loc) · 890 Bytes
Raw
Copy raw file
Download raw file
Edit and raw actions

:::{note} The library is fully async and methods that perform IO need to be run inside an async coroutine. Code examples assume you are following them inside asyncio REPL:

    $ python -m asyncio

Or the code is running inside an async function:

import asyncio
from kasa import Discover


async def main():
    dev = await Discover.discover_single(
        "127.0.0.1", username="[email protected]", password="pw"
    )
    await dev.turn_on()
    await dev.update()


if __name__ == "__main__":
    asyncio.run(main())

All of your code needs to run inside the same event loop so only call asyncio.run once.

The main entry point for the API is {meth}~kasa.Discover.discover and {meth}~kasa.Discover.discover_single which return Device objects. Most newer devices require your TP-Link cloud username and password, but this can be omitted for older devices. :::

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.