* 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>
The highlights of this maintenance release:
* Support to the alternative discovery protocol and foundational work to support other communication protocols, thanks to @sdb9696.
* Reliability improvements by avoiding overflowing device buffers, thanks to @cobryan05.
* Optimizations for downstream device accesses, thanks to @bdraco.
* Support for both pydantic v1 and v2.
asyncio.wait_for has some underlying problems that are only fixed in cpython 3.12.
Use async_timeout instead until the minimum supported version is 3.11+ and it can be replaced with asyncio.timeout
See https://github.com/python/cpython/pull/98518
Besides some small improvements, this release:
* Adds optional dependency for for `orjson` and `kasa-crypt` to speed-up protocol handling by an order of magnitude.
* Drops Python 3.7 support as it is no longer maintained.
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.5.1...0.5.2)
* Drop python 3.7 support
* CI: drop 3.7 and add 3.11
* Remove skipifs that were required for <3.8
* Use pypy-3.8 for CI, re-enable pypy for windows to see if it works now
* Bump readthedocs to use py3.8
* Remove py3.7 failure comment
* 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
* Add module support & modularize existing query
This creates a base to expose more features on the supported devices.
At the moment, the most visible change is that each update cycle gets information from all available modules:
* Basic system info
* Cloud (new)
* Countdown (new)
* Antitheft (new)
* Schedule (new)
* Time (existing, implements the time/timezone handling)
* Emeter (existing, partially separated from smartdevice)
* Fix imports
* Fix linting
* Use device host instead of alias in module repr
* Add property to list available modules, print them in cli state report
* usage: fix the get_realtime query
* separate usage from schedule to avoid multi-inheritance
* Fix module querying
* Add is_supported property to modules
This is the first proper python-kasa release since forking from pyhs100.
* Improved I/O handling, including asyncio interface, request merging & connection sharing
* API improvements throughout the whole package
* Support for LED strips
* Improved bulb support (transitions, support for more models)
* Onboarding is now possible without a mobile app
* Improved documentation
* And various other improvements, see the full changelog for details!
Thanks to all contributors, from testers, and issue reporters to those who have submitted pull requests! Thanks also to those who donated test devices to help to make this release happen!
Special thanks for this release go to @basnijholt (initial asyncio port, push to make this fork happen) and @bdraco (fixing the last release blocker, emeter support for powerstrips).
If you are using python-kasa in your projects, we would be happy to hear about it. Feel free to post a note on Github discussions!
If it is a project that could be interesting for other users and/or developers, feel also free to create a PR to add a short note to the README file.
* Remove bandit from CI, update poetry.lock&pre-commit-config.yaml
* We don't support python 3.6
* poetry install also on tests flow
* remove pytest-azurepipelines
* test_cli: provide return values to patched objects to avoid warning about non-awaited calls
* test_cli: restore alias after testing
* smartstrip: remove internal update() calls for turn_{on,off}, set_led
* Make sure power is always a float
* Fix discovery tests
* Make tests runnable on real devices
* Add a note about running tests on a real device
* test_strip: run update against the parent device
* Prepare 0.4.0.dev3
Most notable changes:
* Devices initialized by discovery are pre-initialized using the discovery response data, so no need for update() directly after discovery
* Only the basic information is requested during discovery, as some HS110 and HS220 devices do not respond to multi-module queries
* Fix mac address parsing for KL430
* Add support for KL125 color temperature ranges
* Documentation updates!
* add types-click for mypy hook
* use generator expression for sum
* 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..
* Move tests to device-type specific test files to make improvements more approachable
* protocol: remove the port parameter from query, as there are no other known ports, fix docstrings
* Revise docstrings, remove superfluous information and remove unused methods ({set,get_icon} and set_time)
* cli: indent device output to make it more easily readable when having multiple devices
* remove adjust flake8 ignores (we have no setup.py anymore)
* pyproject: include cli tool to coverage, add config for interrogate (docstring coverage)
* bulb: raise exception on color_temp error cases instead of returning zero values
* improve bulb tests, simplify conftest
* strip: rename plugs property to children and move it to smartdevice
* Convert to use poetry and pyproject.toml, update README
* add some resources for contributors
* minor adjustments
* ci: separate tests from linting, run using poetry
* add pytest-mock to dev requirements
* combine running tests and reporting to codecov
* generate both xml and html coverage reports
* add codecov to dev dependencies