Python 3.11 ships with latest Debian Bookworm.
pypy is not that widely used with this library based on statistics. It could be added back when pypy supports python 3.11.
Mashumaro is faster and doesn't come with all versioning problems that
pydantic does.
A basic perf test deserializing all of our discovery results fixtures
shows mashumaro as being about 6 times faster deserializing dicts than
pydantic. It's much faster parsing from a json string but that's likely
because it uses orjson under the hood although that's not really our use
case at the moment.
```
PYDANTIC - ms
=================
json dict
-----------------
4.7665 1.3268
3.1548 1.5922
3.1130 1.8039
4.2834 2.7606
2.0669 1.3757
2.0163 1.6377
3.1667 1.3561
4.1296 2.7297
2.0132 1.3471
4.0648 1.4105
MASHUMARO - ms
=================
json dict
-----------------
0.5977 0.5543
0.5336 0.2983
0.3955 0.2549
0.6516 0.2742
0.5386 0.2706
0.6678 0.2580
0.4120 0.2511
0.3836 0.2472
0.4020 0.2465
0.4268 0.2487
```
- Try all valid combinations of protocol/transport/device class and attempt to connect.
- Add cli command `discover config` to return the connection options after connecting via `try_connect_all`.
- The cli command does not return the actual device for processing as this is not a recommended way to regularly connect to devices.
Adds experimental support for the Tapo Camera protocol also used by the H200 hub.
Creates a new SslAesTransport and a derived SmartCamera and SmartCameraProtocol.
Adds username and password arguments to discovery to remove the need to import Credentials.
Creates TypeAliases in Device for connection configuration classes and DeviceType.
Using the API with these changes will only require importing either Discover or Device
depending on whether using Discover.discover() or Device.connect() to
initialize and interact with the API.
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.
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>
Also updates CI pypy versions to be 3.9 and 3.10 which are the currently
[supported
versions](https://www.pypy.org/posts/2024/01/pypy-v7315-release.html).
Otherwise latest cryptography doesn't ship with pypy3.8 wheels and is
unable to build on windows.
Also updates the `codecov-action` to v4 which fixed some intermittent
uploading errors.
* Fix discovery cli to print devices not printed during discovery
* Fix tests
* Fix print exceptions not being propagated
* Fix tests
* Reduce test discover_send time
* Simplify wait logic
* Add tests
* Remove sleep loop and make auth failed a list
- Show discovery results for unsupported devices and devices that fail to authenticate.
- Rename `--show-unsupported` to `--verbose`.
- Remove separate `--timeout` parameter from cli discovery so it's not confused with `--timeout` now added to cli command.
- Add tests.
* Add support for TAPO/SMART KLAP and seperate transports from protocols
* Add tests and some review changes
* Update following review
* Updates following review
* Fix dump_devinfo and add discovery_result to json
* Update following review. Do not serialize aliases.
* Delete kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json
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>
* Add support for the new encryption protocol
This adds support for the new TP-Link discovery and encryption
protocols. It is currently incomplete - only devices without
username and password are current supported, and single device
discovery is not implemented.
Discovery should find both old and new devices. When accessing
a device by IP the --klap option can be specified on the command
line to active the new connection protocol.
sdb9696 - This commit also contains 16 later commits from Simon Wilkinson
squashed into the original
* Update klap changes 2023 to fix encryption, deal with kasa credential switching and work with new discovery changes
* Move from aiohttp to httpx
* Changes following review comments
---------
Co-authored-by: Simon Wilkinson <simon@sxw.org.uk>
* Add plumbing for passing credentials as far as discovery
* Pass credentials to Smart devices
* Rename authentication exception
* Fix tests failure due to test_json_output leaving echo as nop
* Fix test_credentials test
* Do not print credentials, fix echo function bug and improve get type parameter
* Add device class constructor test
* Add comment for echo handling and move assignment