Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions 27 docs/source/smartdevice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ These methods will return the device response, which can be useful for some use

Errors are raised as :class:`SmartDeviceException` instances for the library user to handle.

Simple example script showing some functionality:

.. code-block:: python

import asyncio
from kasa import SmartPlug

async def main():
p = SmartPlug("127.0.0.1")

await p.update()
print(p.alias)

await p.turn_off()


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


Refer to device type specific classes for more examples:

* :class:`SmartPlug`
* :class:`SmartBulb`
* :class:`SmartStrip`
* :class:`SmartDimmer`
* :class:`SmartLightStrip`

.. autoclass:: kasa.SmartDevice
:members:
Expand Down
1 change: 1 addition & 0 deletions 1 kasa/smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class SmartDevice:
* :class:`SmartBulb`
* :class:`SmartStrip`
* :class:`SmartDimmer`
* :class:`SmartLightStrip`

To initialize, you have to await :func:`update()` at least once.
This will allow accessing the properties using the exposed properties.
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.