Update documentation structure and start migrating to markdown (#934)

Starts structuring the documentation library usage into Tutorials, Guides, Explanations and Reference.
Continues migrating new docs from rst to markdown.
Extends the test framework discovery mocks to allow easy writing and testing of code examples.
This commit is contained in:
Steven B
2024-06-03 12:14:10 +03:00
committed by GitHub
parent 767156421b
commit 6616d68d42
31 changed files with 619 additions and 324 deletions

View File

@@ -13,21 +13,24 @@ Most newer devices require your TP-Link cloud username and password, but this ca
>>> from kasa import Device, Discover, Credentials
:func:`~kasa.Discover.discover` returns a list of devices on your network:
:func:`~kasa.Discover.discover` returns a dict[str,Device] of devices on your network:
>>> devices = await Discover.discover(credentials=Credentials("user@example.com", "great_password"))
>>> for dev in devices:
>>> for dev in devices.values():
>>> await dev.update()
>>> print(dev.host)
127.0.0.1
127.0.0.2
127.0.0.3
127.0.0.4
127.0.0.5
:meth:`~kasa.Discover.discover_single` returns a single device by hostname:
>>> dev = await Discover.discover_single("127.0.0.1", credentials=Credentials("user@example.com", "great_password"))
>>> dev = await Discover.discover_single("127.0.0.3", credentials=Credentials("user@example.com", "great_password"))
>>> await dev.update()
>>> dev.alias
Living Room
Living Room Bulb
>>> dev.model
L530
>>> dev.rssi