Commit Graph

68 Commits

Author SHA1 Message Date
Teemu R
b4036e55ac
Prepare 0.4.1 (#288)
This minor release fixes issues that were found after homeassistant integration got converted over from pyhs100.

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

**Implemented enhancements:**

- Add --type option to cli [\#269](https://github.com/python-kasa/python-kasa/pull/269) ([rytilahti](https://github.com/rytilahti))
- Minor improvements to onboarding doc [\#264](https://github.com/python-kasa/python-kasa/pull/264) ([rytilahti](https://github.com/rytilahti))
- Add fixture file for KL135 [\#263](https://github.com/python-kasa/python-kasa/pull/263) ([ErikSGross](https://github.com/ErikSGross))
- Add KL135 color temperature range [\#256](https://github.com/python-kasa/python-kasa/pull/256) ([rytilahti](https://github.com/rytilahti))
- Add py.typed to flag that the package is typed [\#251](https://github.com/python-kasa/python-kasa/pull/251) ([rytilahti](https://github.com/rytilahti))
- Add script to check supported devices, update README [\#242](https://github.com/python-kasa/python-kasa/pull/242) ([rytilahti](https://github.com/rytilahti))
- Add perftest to devtools [\#236](https://github.com/python-kasa/python-kasa/pull/236) ([rytilahti](https://github.com/rytilahti))
- Add KP401 US fixture [\#234](https://github.com/python-kasa/python-kasa/pull/234) ([bdraco](https://github.com/bdraco))
- Add KL60 US KP105 UK fixture [\#233](https://github.com/python-kasa/python-kasa/pull/233) ([bdraco](https://github.com/bdraco))
- Make cli interface more consistent [\#232](https://github.com/python-kasa/python-kasa/pull/232) ([rytilahti](https://github.com/rytilahti))
- Add KL400, KL50 fixtures [\#231](https://github.com/python-kasa/python-kasa/pull/231) ([bdraco](https://github.com/bdraco))
- Add fixture for newer KP400 firmware [\#227](https://github.com/python-kasa/python-kasa/pull/227) ([bdraco](https://github.com/bdraco))
- Switch to poetry-core [\#226](https://github.com/python-kasa/python-kasa/pull/226) ([fabaff](https://github.com/fabaff))
- Add fixtures for LB110, KL110, EP40, KL430, KP115 [\#224](https://github.com/python-kasa/python-kasa/pull/224) ([bdraco](https://github.com/bdraco))

**Fixed bugs:**

- Discovery on WSL results in OSError: \[Errno 22\] Invalid argument [\#246](https://github.com/python-kasa/python-kasa/issues/246)
- New firmware for HS103 blocking local access? [\#42](https://github.com/python-kasa/python-kasa/issues/42)
- Pin mistune to \<2.0.0 to fix doc builds [\#270](https://github.com/python-kasa/python-kasa/pull/270) ([rytilahti](https://github.com/rytilahti))
- Catch exceptions raised on unknown devices during discovery [\#240](https://github.com/python-kasa/python-kasa/pull/240) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Control device with alias via python api? [\#285](https://github.com/python-kasa/python-kasa/issues/285)
- Can't install using pip install python-kasa [\#255](https://github.com/python-kasa/python-kasa/issues/255)
- Kasa Smart Bulb KL135 - Unknown color temperature range error [\#252](https://github.com/python-kasa/python-kasa/issues/252)
- KL400 Support [\#247](https://github.com/python-kasa/python-kasa/issues/247)
- Cloud support? [\#245](https://github.com/python-kasa/python-kasa/issues/245)
- Support for kp401 [\#241](https://github.com/python-kasa/python-kasa/issues/241)
- LB130 Bulb stopped working [\#237](https://github.com/python-kasa/python-kasa/issues/237)
- Unable to constantly query bulb in loop [\#225](https://github.com/python-kasa/python-kasa/issues/225)
- HS103: Unable to query the device: unpack requires a buffer of 4 bytes [\#187](https://github.com/python-kasa/python-kasa/issues/187)
- Help request - query value [\#171](https://github.com/python-kasa/python-kasa/issues/171)
- Can't Discover Devices [\#164](https://github.com/python-kasa/python-kasa/issues/164)
- Concurrency performance question [\#110](https://github.com/python-kasa/python-kasa/issues/110)
- Define the port by self? [\#108](https://github.com/python-kasa/python-kasa/issues/108)
- Convert homeassistant integration to use the library [\#9](https://github.com/python-kasa/python-kasa/issues/9)

**Merged pull requests:**

- Publish to pypi on github release published [\#287](https://github.com/python-kasa/python-kasa/pull/287) ([rytilahti](https://github.com/rytilahti))
- Relax asyncclick version requirement [\#286](https://github.com/python-kasa/python-kasa/pull/286) ([rytilahti](https://github.com/rytilahti))
- Do not crash on discovery on WSL [\#283](https://github.com/python-kasa/python-kasa/pull/283) ([rytilahti](https://github.com/rytilahti))
- Add python 3.10 to CI [\#279](https://github.com/python-kasa/python-kasa/pull/279) ([rytilahti](https://github.com/rytilahti))
- Use codecov-action@v2 for CI [\#277](https://github.com/python-kasa/python-kasa/pull/277) ([rytilahti](https://github.com/rytilahti))
- Add coverage\[toml\] dependency to fix coverage on CI [\#271](https://github.com/python-kasa/python-kasa/pull/271) ([rytilahti](https://github.com/rytilahti))
- Allow publish on test pypi workflow to fail [\#248](https://github.com/python-kasa/python-kasa/pull/248) ([rytilahti](https://github.com/rytilahti))
2022-01-14 16:47:49 +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
Fabian Affolter
7b99f7e9a4
Switch to poetry-core (#226) 2021-10-02 00:51:16 +02:00
Teemu R
1a3c73e42f
Release 0.4.0 (#221)
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.
2021-09-27 19:10:05 +02:00
Teemu R
85f17ab91c
Release 0.4.0.dev5 (#215)
This release introduces re-using the device connection to get rid of (sometimes slow) connection establishment.
This is especially useful for emeter-enabled smart strips or any other usecases requiring consecutive I/O requests.

[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.0.dev4...0.4.0.dev5)

**Merged pull requests:**

- Add KL130 fixture, initial lightstrip tests [\#214](https://github.com/python-kasa/python-kasa/pull/214) ([rytilahti](https://github.com/rytilahti))
- Keep connection open and lock to prevent duplicate requests [\#213](https://github.com/python-kasa/python-kasa/pull/213) ([bdraco](https://github.com/bdraco))
- Cleanup discovery & add tests [\#212](https://github.com/python-kasa/python-kasa/pull/212) ([rytilahti](https://github.com/rytilahti))
2021-09-24 23:38:30 +02:00
Teemu R
bdb07a749c
Release 0.4.0.dev4 (#210)
* Release 0.4.0.dev4

The most important enhancements in this release are:
* Support for emeter on strip sockets
* Fix discovery and update() on some devices that do not support multi-module queries (e.g., HS200)
* Improved support for bulbs

[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.4.0.dev3...0.4.0.dev4)

**Implemented enhancements:**

- HS300 Children plugs have emeter [\#64](https://github.com/python-kasa/python-kasa/issues/64)
- Improve emeterstatus API, move into own module [\#205](https://github.com/python-kasa/python-kasa/pull/205) ([rytilahti](https://github.com/rytilahti))
- Avoid temp array during encrypt and decrypt [\#204](https://github.com/python-kasa/python-kasa/pull/204) ([bdraco](https://github.com/bdraco))
- Add emeter support for strip sockets [\#203](https://github.com/python-kasa/python-kasa/pull/203) ([bdraco](https://github.com/bdraco))
- Add own device type for smartstrip children [\#201](https://github.com/python-kasa/python-kasa/pull/201) ([rytilahti](https://github.com/rytilahti))
- bulb: allow set\_hsv without v, add fallback ct range [\#200](https://github.com/python-kasa/python-kasa/pull/200) ([rytilahti](https://github.com/rytilahti))
- Improve bulb support \(alias, time settings\) [\#198](https://github.com/python-kasa/python-kasa/pull/198) ([rytilahti](https://github.com/rytilahti))
- Improve testing harness to allow tests on real devices [\#197](https://github.com/python-kasa/python-kasa/pull/197) ([rytilahti](https://github.com/rytilahti))
- cli: add human-friendly printout when calling temperature on non-supported devices [\#196](https://github.com/python-kasa/python-kasa/pull/196) ([JaydenRA](https://github.com/JaydenRA))

**Fixed bugs:**

- KL430: Throw error for Device specific information [\#189](https://github.com/python-kasa/python-kasa/issues/189)
- dump\_devinfo: handle latitude/longitude keys properly [\#175](https://github.com/python-kasa/python-kasa/pull/175) ([rytilahti](https://github.com/rytilahti))

**Closed issues:**

- Feature Request - Toggle Command [\#188](https://github.com/python-kasa/python-kasa/issues/188)
- Is It Compatible With HS105? [\#186](https://github.com/python-kasa/python-kasa/issues/186)
- Cannot use some functions with KP303 [\#181](https://github.com/python-kasa/python-kasa/issues/181)
- Help needed - awaiting game  [\#179](https://github.com/python-kasa/python-kasa/issues/179)
- Version inconsistency between CLI and pip [\#177](https://github.com/python-kasa/python-kasa/issues/177)
- Release 0.4.0.dev3? [\#169](https://github.com/python-kasa/python-kasa/issues/169)
- Discover does not support specifying network interface [\#167](https://github.com/python-kasa/python-kasa/issues/167)
- Can't command or query HS200 v5 switch [\#161](https://github.com/python-kasa/python-kasa/issues/161)

**Merged pull requests:**

- More CI fixes [\#208](https://github.com/python-kasa/python-kasa/pull/208) ([rytilahti](https://github.com/rytilahti))
- Fix CI dep installation [\#207](https://github.com/python-kasa/python-kasa/pull/207) ([rytilahti](https://github.com/rytilahti))
- Use github actions instead of azure pipelines [\#206](https://github.com/python-kasa/python-kasa/pull/206) ([rytilahti](https://github.com/rytilahti))
- Add KP115 fixture [\#202](https://github.com/python-kasa/python-kasa/pull/202) ([rytilahti](https://github.com/rytilahti))
- Perform initial update only using the sysinfo query [\#199](https://github.com/python-kasa/python-kasa/pull/199) ([rytilahti](https://github.com/rytilahti))
- Add real kasa KL430\(UN\) device dump [\#192](https://github.com/python-kasa/python-kasa/pull/192) ([iprodanovbg](https://github.com/iprodanovbg))
- Use less strict matcher for kl430 color temperature [\#190](https://github.com/python-kasa/python-kasa/pull/190) ([rytilahti](https://github.com/rytilahti))
- Add EP10\(US\) 1.0 1.0.2 fixture [\#174](https://github.com/python-kasa/python-kasa/pull/174) ([nbrew](https://github.com/nbrew))
- Add a note about using the discovery target parameter [\#168](https://github.com/python-kasa/python-kasa/pull/168) ([leandroreox](https://github.com/leandroreox))

* replace pypy3 with pypy-3.7 as we do not support python3.6 anyway

* skip pypy-3.7 on windows to avoid flaky ci
2021-09-24 01:44:22 +02: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
1803a83ae6
Improve testing harness to allow tests on real devices (#197)
* 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
2021-09-19 23:45:48 +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
a926ff5980
Release 0.4.0.dev2 (#118) 2020-11-21 22:52:13 +01: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
Teemu R
c67bda8230
Release 0.4.0.dev1 (#93)
* Release 0.4.0.pre1

* update RELEASING.md

* Fix release naming from .pre to .dev
2020-07-28 16:55:56 +02:00
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
Teemu R
644a10a0d1
General cleanups all around (janitoring) (#63)
* 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
2020-05-27 16:55:18 +02:00
Teemu R
ed57563e8b
Convert to use poetry & pyproject.toml for dep & build management (#54)
* 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
2020-05-12 12:11:47 +02:00