Commit Graph

30 Commits

Author SHA1 Message Date
Steven B
6616d68d42 Update documentation structure and start migrating to markdown ()
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.
2024-06-03 10:14:10 +01:00
Steven B
273c541fcc Add light presets common module to devices. ()
Adds light preset common module for switching to presets and saving presets.
Deprecates the `presets` attribute and `save_preset` method from the `bulb` 
interface in favour of the modular approach.  Allows setting preset for `iot` 
which was not previously supported.
2024-05-19 11:20:18 +01:00
Steven B
3490a1ef84 Add tutorial doctest module and enable top level await ()
Add a tutorial module with examples that can be tested with `doctest`.

In order to simplify the examples they can be run with doctest allowing
top level await statements by adding a fixture to patch the builtins
that xdoctest uses to test code.

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2024-05-16 18:13:44 +02:00
Teemu R
1e8e289ac7 Move contribution instructions into docs ()
Moves the instructions away from README.md to keep it simpler, and
extend the documentation to be up-to-date and easier to approach.

---------

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-05-08 15:25:22 +02:00
Teemu R
253287c7b7 Add warning about tapo watchdog () 2024-05-07 14:46:59 +02:00
Steven B
fcad0d2344 Add WallSwitch device type and autogenerate supported devices docs () 2024-03-01 18:32:45 +00:00
Steven B
8c39e81a40 Rename and deprecate exception classes ()
# Public #
SmartDeviceException -> KasaException
UnsupportedDeviceException(SmartDeviceException) -> UnsupportedDeviceError(KasaException)
TimeoutException(SmartDeviceException, asyncio.TimeoutError) -> TimeoutError(KasaException, asyncio.TimeoutError)

Add new exception for error codes -> DeviceError(KasaException)
AuthenticationException(SmartDeviceException) -> AuthenticationError(DeviceError)

# Internal #
RetryableException(SmartDeviceException) -> _RetryableError(DeviceError)
ConnectionException(SmartDeviceException) -> _ConnectionError(KasaException)
2024-02-21 16:52:55 +01:00
Steven B
0d0f56414c Switch from TPLinkSmartHomeProtocol to IotProtocol/XorTransport ()
* Switch from TPLinkSmartHomeProtocol to IotProtocol/XorTransport

* Add test

* Update docs

* Fix ruff deleting deprecated import
2024-01-26 09:11:31 +00:00
Teemu R
2d8b966e5b Document authenticated provisioning () 2024-01-24 22:09:27 +00:00
Steven B
6b0a72d5a7 Add protocol and transport documentation ()
* Add protocol and transport documentation

* Update post review
2024-01-22 17:45:19 +01:00
Steven B
3e0cd07b7c Update docs for newer devices and DeviceConfig ()
* Update docs for newer devices and DeviceConfig

* Tweak docs post review

* Move sentence to newline

* Update post review

* Update following review
2024-01-10 20:13:14 +01:00
sdb9696
f6fd898faf Add DeviceConfig to allow specifying configuration parameters ()
* Add DeviceConfig handling

* Update post review

* Further update post latest review

* Update following latest review

* Update docstrings and docs
2023-12-29 20:17:15 +01:00
alanblake
ec3ea39a37 Fix typo in cli.rst () 2023-12-29 16:05:47 +01:00
J. Nick Koston
e98252ff17 Move connect_single to SmartDevice.connect ()
This refactors `Discover.connect_single` by moving device instance construction into a separate device factory module.
New `SmartDevice.connect(host, *, port, timeout, credentials, device_type)` class method replaces the functionality of `connect_single`,
and also now allows constructing device instances without relying on UDP discovery for type discovery if `device_type` parameter is set.

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2023-11-21 23:48:53 +01:00
Teemu R
24da24efad Document cli tool --target for discovery ()
This adds rudimentary documentation on the `--target` option of the cli tool.
2023-08-14 14:32:24 +02:00
Teemu R
02c857d472 Some release preparation janitoring ()
* Use myst-parser for readme.md doc injection

* Relax version pins

* Define bug tracker and doc links for pypi

* Update pre-commit hooks
2023-02-18 22:09:35 +01:00
Teemu R
1212715dde Minor fixes to smartbulb docs () 2023-02-18 21:17:19 +01:00
Teemu R
ef98c2aed9 Implement changing the bulb turn-on behavior ()
* Implement changing the bulb turn-on behavior

* Improve docstrings a bit

* Improve docs and expose TurnOnBehavior(s)

* fix typing
2022-10-27 17:40:54 +02:00
Teemu R
f32f7f3925 Add support for bulb presets ()
* Add support for bulb presets

* Update docs
2022-10-23 00:15:47 +02:00
HankB
b386485ab0 Update smartstrip.rst ()
```text
hbarta@pilog3b:~$ kasa --type strip --host 192.168.20.215 on
Turning on TP-LINK_Smart Plug_83A6
hbarta@pilog3b:~$ kasa --strip --host 192.168.20.215 on
Usage: kasa [OPTIONS] COMMAND [ARGS]...
Try 'kasa --help' for help.

Error: No such option: --strip (Possible options: --host, --type)
hbarta@pilog3b:~$
```
2022-10-19 01:16:11 +02:00
HankB
e1a30f92e4 fix more outdated CLI examples, remove EP40 from bulb list ()
* Fix more outdated cli examples

* remove EP40 (smart strip) from bulb list
2022-10-18 23:37:54 +02:00
Teemu R
2eecf39bae Add ToCs for doc pages () 2022-10-18 19:08:10 +02:00
Teemu R
a39cef9a8c Export modules & make sphinx happy () 2022-04-06 01:41:08 +02:00
Teemu R
d848117384 Various documentation updates ()
* Add a note about socket sharing

* Show inherited members for apidocs

* Remove outdated note of emeters not being supported on smartstrips

* Describe emeter and usage modules, add note about NTP for time sync

* Describe lib design and modules

* Bump sphinx version, ignore d001 (line-length) for doc8

* demote energy & usage to 3rd level, promote api for 2nd
2022-04-06 01:13:27 +02:00
Teemu R
6aea09fc44 Minor improvements to onboarding doc ()
This makes the commands more copy&pastable on new devices
2021-12-08 15:32:57 +01:00
Flaviof
87730e6c4e Fix documentation on Smart strips ()
Trivial Fix

Fix documentation and the corresponding command when
turning on/off example.
2021-02-15 17:59:17 +01:00
Teemu R
98b40b5072 Improve cli documentation for bulbs and power strips () 2020-12-09 11:13:14 +02:00
Teemu R
6844166c0d add a small example script to show library usage ()
* add a small example script to show library usage

* asyncio.run++
2020-07-20 16:42:37 +02:00
Teemu R
d30d00a3ff Add support for lightstrips (KL430) ()
* Preliminary support for light strips

* Add color temperature range and cleanup, thanks to @darkoppressor

* Use lightstrip instead of {led,light}strip consistently everywhere
* The cli flag is now --lightstrip

* add apidocs

* Add fixture file for KL430

Signed-off-by: Kevin Wells <darkoppressor@gmail.com>

* Add discovery support, expose effect and length of the strip

* use set_light_state instead of transition_light_state

* Add tests for lightstrip

* add doctests

* Add KL430 to supported devices in README

Co-authored-by: Kevin Wells <darkoppressor@gmail.com>
2020-07-19 22:32:17 +02:00
Teemu R
f9a987ca18 Simplify API documentation by using doctests ()
* 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