python-kasa/docs/source/cli.rst
Teemu R f9a987ca18
Simplify API documentation by using doctests (#73)
* Add doctests to SmartBulb

* Add SmartDevice doctests, cleanup README.md

* add doctests for smartplug and smartstrip

* add discover doctests

* Fix bulb mock

* add smartdimmer doctests

* add sphinx-generated docs, cleanup readme a bit

* remove sphinx-click as it does not work with asyncclick

* in preparation for rtd hooking, move doc deps to be separate from dev deps

* pytestmark needs to be applied separately for each and every file, this fixes the tests

* use pathlib for resolving relative paths

* Skip discovery doctest on python3.7

The code is just fine, but some reason the mocking behaves differently between 3.7 and 3.8.
The latter seems to accept a discrete object for asyncio.run where the former expects a coroutine..
2020-06-30 02:29:52 +02:00

29 lines
1.4 KiB
ReStructuredText

Command-line usage
==================
The package is shipped with a console tool named kasa, please refer to ``kasa --help`` for detailed usage.
The device to which the commands are sent is chosen by `KASA_HOST` environment variable or passing ``--host <address>`` as an option.
To see what is being sent to and received from the device, specify option ``--debug``.
To avoid discovering the devices when executing commands its type can be passed by specifying either ``--plug`` or ``--bulb``,
if no type is given its type will be discovered automatically with a small delay.
Some commands (such as reading energy meter values and setting color of bulbs) additional parameters are required,
which you can find by adding ``--help`` after the command, e.g. ``kasa emeter --help`` or ``kasa hsv --help``.
If no command is given, the ``state`` command will be executed to query the device state.
Provisioning
~~~~~~~~~~~~
You can provision your device without any extra apps by using the ``kasa wifi`` command:
1. If the device is unprovisioned, connect to its open network
2. Use ``kasa discover`` (or check the routes) to locate the IP address of the device (likely 192.168.0.1)
3. Scan for available networks using ``kasa wifi scan``
4. Join/change the network using ``kasa wifi join`` command, see ``--help`` for details.
``kasa --help``
~~~~~~~~~~~~~~~
.. program-output:: kasa --help