Commit Graph

23 Commits

Author SHA1 Message Date
sdb9696
30f217b8ab
Add klap protocol (#509)
* 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>
2023-11-20 14:17:10 +01:00
Teemu R
53021f07fe
Add support for pydantic v2 using v1 shims (#504) 2023-08-28 17:48:49 +02:00
sdb9696
ceb42e5583
Update pyproject.toml isort profile, dev group header and poetry.lock (#487) 2023-08-03 13:19:31 +02:00
J. Nick Koston
117a7ac64a
Replace asyncio.wait_for with async-timeout (#480)
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
2023-07-21 11:50:54 +02:00
J. Nick Koston
c9faa1f78f
Only update pyyaml instead of pinning it as a dep (#482) 2023-07-21 11:13:36 +02:00
J. Nick Koston
afd54d11d3
Add optional kasa-crypt dependency for speedups (#464)
If installed, use the optimized protocol encryption procedures implemented as a C extension by kasa-crypt (https://pypi.org/project/kasa-crypt/
2023-06-30 02:43:01 +02:00
J. Nick Koston
2d42ca301f
Use orjson when already installed or with speedups extra (#466)
* Use orjson when already installed

* Use orjson when already installed

* fix patch target

* fix patch target

* add speedups extra

* Update README.md

* Update README.md
2023-06-18 01:03:04 +02:00
Teemu R
39310f3f02
Remove importlib-metadata dependency (#457)
This is no longer needed, as python 3.8 has native importlib.metadata
2023-05-17 20:33:02 +02:00
Teemu R
e7b7f1de94
Update dependencies to fix CI (#454)
* Update dependencies

* Update pre-commit dependencies
2023-05-17 19:15:52 +02:00
Teemu R
02c857d472
Some release preparation janitoring (#432)
* 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
dependabot[bot]
bfafbf9512
Bump certifi from 2021.10.8 to 2022.12.7 (#409)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2021.10.8 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2021.10.08...2022.12.07)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-11 19:28:28 +01:00
Teemu R
d848117384
Various documentation updates (#333)
* 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 Rytilahti
68038c93df Bump version to 0.5.0.dev0 2022-04-05 19:27:46 +02:00
Teemu R
3926f3224f Add module support & query their information during update cycle (#243)
* 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
2022-04-05 19:27:46 +02:00
Teemu R
6f5a60ad43
Release 0.4.2 (#321)
This is the last release prior restructuring the code to enable easier extendability by moving towards more modular architecture.
The most prominent change in this release is the support for effects on light strips.

[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.1...0.4.2)

**Implemented enhancements:**

- Allow environment variables for discovery target, device type and debug [\#313](https://github.com/python-kasa/python-kasa/pull/313) (@rytilahti)
- Add 'internal\_state' to return the results from the last update query [\#306](https://github.com/python-kasa/python-kasa/pull/306) (@rytilahti)
- Drop microsecond precision for on\_since [\#296](https://github.com/python-kasa/python-kasa/pull/296) (@rytilahti)
- Add effect support for light strips [\#293](https://github.com/python-kasa/python-kasa/pull/293) (@bdraco)

**Fixed bugs:**

- TypeError: \_\_init\_\_\(\) got an unexpected keyword argument 'package\_name' [\#311](https://github.com/python-kasa/python-kasa/issues/311)
- RuntimeError: Event loop is closed on WSL [\#294](https://github.com/python-kasa/python-kasa/issues/294)
- Don't crash on devices not reporting features [\#317](https://github.com/python-kasa/python-kasa/pull/317) (@rytilahti)

**Closed issues:**

- SmartDeviceException: Communication error on system:set\_relay\_state [\#309](https://github.com/python-kasa/python-kasa/issues/309)
- Add Support: ES20M and KS200M motion/light switches [\#308](https://github.com/python-kasa/python-kasa/issues/308)
- New problem with installing on Ubuntu 20.04.3 LTS [\#305](https://github.com/python-kasa/python-kasa/issues/305)
- KeyError: 'emeter' when discovering [\#302](https://github.com/python-kasa/python-kasa/issues/302)
- RuntimeError: Event loop is closed  [\#291](https://github.com/python-kasa/python-kasa/issues/291)
- provisioning format [\#290](https://github.com/python-kasa/python-kasa/issues/290)
- Fix CI publishing on pypi [\#222](https://github.com/python-kasa/python-kasa/issues/222)
- LED strips effects are not supported \(was LEDs is not turning on after switching on\) [\#191](https://github.com/python-kasa/python-kasa/issues/191)

**Merged pull requests:**

- Add pyupgrade to CI runs [\#314](https://github.com/python-kasa/python-kasa/pull/314) (@rytilahti)
- Depend on asyncclick \>= 8 [\#312](https://github.com/python-kasa/python-kasa/pull/312) (@rytilahti)
- Guard emeter accesses to avoid keyerrors [\#304](https://github.com/python-kasa/python-kasa/pull/304) (@rytilahti)
- cli: cleanup discover, fetch update prior device access [\#303](https://github.com/python-kasa/python-kasa/pull/303) (@rytilahti)
- Fix unsafe \_\_del\_\_ in TPLinkSmartHomeProtocol [\#300](https://github.com/python-kasa/python-kasa/pull/300) (@bdraco)
- Improve typing for protocol class [\#289](https://github.com/python-kasa/python-kasa/pull/289) (@rytilahti)
- Added a fixture file for KS220M [\#273](https://github.com/python-kasa/python-kasa/pull/273) (@mrbetta)
2022-03-21 22:34:44 +01:00
Teemu R
15906ec232
Depend on asyncclick >= 8 (#312) 2022-02-14 18:26:51 +01:00
Teemu R
6ece506a3b
Relax asyncclick version requirement (#286)
* Add package_name to version_option(), breaks --version on click < 8
2022-01-14 16:32:32 +01:00
Teemu R
a817d9cab1
Add python 3.10 to CI (#279)
* Add python 3.10 to CI

* Require pytest >=6.2.5

Required for running on python 3.10 (https://github.com/pytest-dev/pytest/pull/8540)

* Update lockfile

* Update pre-commit hooks
2021-12-17 17:48:03 +01:00
Teemu R
62c9f0ae64
Add coverage[toml] dependency to fix coverage on CI (#271) 2021-12-13 18:40:50 +01:00
Teemu R
8554a1db29
Pin mistune to <2.0.0 to fix doc builds (#270) 2021-12-08 15:31:55 +01:00
Teemu R
d7202883e9
More CI fixes (#208)
* 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
2021-09-23 19:09:19 +02:00
Teemu R
0aa20f6cf9
Prepare 0.4.0.dev3 (#172)
* 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
2021-06-16 18:16:45 +03:00
Teemu R
c59b748a06
Pin dependencies on major versions, add poetry.lock (#94)
* Pin dependencies on major versions, add poetry.lock

* Fix linting
2020-07-29 19:28:00 +02:00