Commit Graph

682 Commits

Author SHA1 Message Date
sdb9696
ceb42e5583
Update pyproject.toml isort profile, dev group header and poetry.lock (#487) 2023-08-03 13:19:31 +02:00
Teemu R
e98475a1b2
Release 0.5.3 (#485)
This release adds support for defining the device port and introduces dependency on async-timeout which improves timeout handling.

[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.5.2...0.5.3)
2023-07-23 15:49:27 +02:00
J. Nick Koston
677ef9c3ef
Add tests for KP200 (#483)
* Add tests for KP200

This one worked out of the box sans the OUI not being in the list

https://github.com/home-assistant/core/pull/97062

* it is a strip
2023-07-22 23:55:42 +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
Viktar Karpach
9b039d8374
Make device port configurable (#471) 2023-07-10 01:55:27 +02:00
Teemu R
6199521269
Release 0.5.2 (#475)
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)
2023-07-02 16:26:29 +02:00
J. Nick Koston
fde156c859
Add benchmarks for speedups (#473)
* Add benchmarks for speedups

* Update README.md

* Update README.md

Co-authored-by: Teemu R. <tpr@iki.fi>

* relo

* Update README.md

* document benchmark

* Update README.md

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2023-07-02 01:03:50 +02:00
xinud190
b83986bd51
Add fixture for KP405 Smart Dimmer Plug (#470)
* Add files via upload

* Add to KP405 to dimmers, update README

---------

Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
2023-06-30 02:53:23 +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
Brian Davis
9550cbd2f7
Exclude querying certain modules for KL125(US) which cause crashes (#451)
* commented out modules that break

* added exclusion logic to smartdevice.py

* cleaning up a name

* removing test fixture that isn't related to this PR

* incorporating PR feedback

* fixed an if statement

* reduced exclusion list to just 'cloud'

* Tidy up the issue comment

Co-authored-by: Teemu R. <tpr@iki.fi>

* this seems to be what the linter whats

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2023-05-18 17:04:24 +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
ce58cc1a6a
Add methods to configure dimmer settings (#429) 2023-05-17 20:10:39 +02:00
Teemu R
18ce40b6bb
Add inactivity setting for the motion module (#453)
* Add inactivity setting for the motion module

* Fix set_cold_time payload

Co-authored-by: Matt Whitlock <whitslack@users.noreply.github.com>

* Add mention about "smart control"

---------

Co-authored-by: Matt Whitlock <whitslack@users.noreply.github.com>
2023-05-17 20:08:05 +02:00
Teemu R
ce5821a35f
Drop python 3.7 support (#455)
* 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
2023-05-17 20:03:08 +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
233f1c9534
Cleanup fixture filenames (#448)
* Mark mocked fixtures as such

* Use consistent filenames including the swver

* Remove executable bit

* Remove duplicate KL130(US)

* Remove unnecessary mocks where we have real ones available

* Fix filenames in tests
2023-04-01 17:10:46 +02:00
Teemu R
505b63dd55
Allow effect presets seen on light strips (#440)
* Make hue, saturation and color_temp optional for smartbulbpresets

* Adjust bulb preset attributes for effect mode

* Don't send None values on save_preset

* Add tests for save_preset payloads
2023-04-01 16:15:58 +02:00
Teemu R
4d514f983b
Return result objects for cli discover and implicit 'state' (#446)
This will make --json to output relevant contents even when no command is defined (i.e., when calling 'kasa --host <host> --json' or 'kasa --target <bcast> --json'.
2023-03-30 01:53:38 +02:00
Teemu R
6be2f387f0
Prepare 0.5.1 (#434) 2023-02-18 22:40:42 +01: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
Teemu R
016f4dfd19
Add support for json output (#430)
* Add json support

* Add tests

* Check if test_json_output works on ci using py3.8+

* Add a proper note why py3.7 test for json_output are disabled
2023-02-18 21:41:08 +01:00
Teemu R
1212715dde
Minor fixes to smartbulb docs (#431) 2023-02-18 21:17:19 +01:00
Julian Davis
43ed47eca8
Return usage.get_{monthstat,daystat} in expected format (#394)
* Basic fix for issue: https://github.com/python-kasa/python-kasa/issues/373
Change usage module get_daystat and get_monthat to return dictionaries of date index: time values as spec'd instead of raw usage data. Output matches emeter module get_daystat and get_monthstat

* Fixed some formatting and lint warnings to comply with black/flake8
Use the new _convert function in emeter for all conversions rather than the one in smartdevice.py
Removed unused function _emeter_convert_emeter_data from smartdevice.py

* Added a first pass test module for testing the new usage conversion function

* Changes based on PR feedback
Tidied up some doc string comments
Added a check for explicit values from conversion function

* Rebase on top of current master, fix docstrings

---------

Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
2023-02-18 20:53:02 +01:00
Teemu R
12c98eb58d
Add transition parameter to lightstrip's set_effect (#416) 2023-02-18 18:03:54 +01:00
Teemu R
92636fe82d
Pretty-print all exceptions from cli commands (#428)
Print out the repr of captured exception instead of full traceback
2023-02-18 17:32:03 +01:00
Teemu R
dd044130d4
Use rich for prettier output, if available (#403)
Use rich for prettier output, if available.

This does not add a new dependency, but rather uses rich if it's installed.
2023-02-18 17:31:06 +01:00
Julian Davis
334ba1713a
Added .gitattributes file to retain LF only EOL markers when checking out on Windows (#399) 2023-02-18 17:20:06 +01:00
Teemu R
6e7a588d40
Add brightness to lightstrip's set_effect (#415)
* Add brightness parameter to lightstrip's set_effect

* Use None as default as effects have different default brightnesses
2023-01-21 00:25:59 +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
362c60d7b1
Add FUNDING.yml (#402) 2022-11-15 19:12:38 +01:00
Teemu R
327efb6c65
Update pre-commit hooks (#401)
* Update pre-commit hooks

* Fix implicit optionals
2022-11-15 19:05:08 +01:00
Teemu R
ad5b5c2230
Update pre-commit url for flake8 (#400) 2022-11-15 18:26:23 +01:00
Julian Davis
866c8d6db5
Fix pytest warnings about asyncio (#397)
Turn on ayncio auto mode for pytest and remove the global async marking flag
2022-11-13 23:34:47 +01:00
Teemu R
9cb2a56405
Add a note that transition is not supported by all devices (#398) 2022-11-11 21:06:54 +01:00
Aric Forrest
ec06331737
Adding cli command to delete a schedule rule (#391)
* adding cli option to delete rule

* resolving black linting issue

* simplifying command name

Co-authored-by: Teemu R. <tpr@iki.fi>

* updating rule filter

Co-authored-by: Teemu R. <tpr@iki.fi>
2022-11-03 02:11:24 +01:00
Teemu R
ef98c2aed9
Implement changing the bulb turn-on behavior (#381)
* 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
Julian Davis
1ac6c66277
Fix type hinting issue with call to click.Choice (#387)
* Fix type hinting issue with call to click.Choice which takes a Sequence not dictionary. Convert TYPE_TO_CLASS keys to a list to pass in.

* Update kasa/cli.py

Co-authored-by: Teemu R. <tpr@iki.fi>

Co-authored-by: Jules Davis <jules@focalpointvr.com>
Co-authored-by: Teemu R. <tpr@iki.fi>
2022-10-27 17:40:24 +02:00
Teemu R
f32f7f3925
Add support for bulb presets (#379)
* Add support for bulb presets

* Update docs
2022-10-23 00:15:47 +02:00
HankB
b386485ab0
Update smartstrip.rst (#382)
```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 (#383)
* 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 (#380) 2022-10-18 19:08:10 +02:00
Teemu R
f493fa1dca
Clarify information about supported devices (#377)
* Clarify information about supported devices

* Use single backticks
2022-10-17 18:16:40 +02:00
Teemu R
cece84352a
Manually pass the codecov token in CI (#378) 2022-10-17 18:08:26 +02:00
Teemu R
13052ac7a1
Fix year emeter for cli by using kwarg for year parameter (#372)
* Fix year emeter for cli by using kwarg for year parameter

* Improve tests

* Skip test_emeter on python3.7
2022-10-03 20:28:05 +02:00
Felix Yan
7aebef56ca
Correct typos in smartdevice.py (#358) 2022-07-17 19:19:09 +02:00
gritstub
57fac9a156
Add fixtures for KS200M (#356) 2022-06-28 18:53:23 +02:00
gritstub
d7295bdf6d
Add fixtures for ES20M (#353) (#354)
Co-authored-by: Teemu R <tpr@iki.fi>
2022-06-28 13:06:34 +02:00
gritstub
4c55289255
Add fixtures for KS230 (#355) 2022-06-28 12:56:36 +02:00