Commit Graph

463 Commits

Author SHA1 Message Date
Steven B
3e0cd07b7c
Update docs for newer devices and DeviceConfig (#614)
* Update docs for newer devices and DeviceConfig

* Tweak docs post review

* Move sentence to newline

* Update post review

* Update following review
2024-01-10 20:13:14 +01:00
Steven B
897db674c2
Add L900-10 fixture and it's additional component requests (#629) 2024-01-10 19:40:36 +01:00
J. Nick Koston
460054ced7
Avoid recreating struct each request in legacy protocol (#628) 2024-01-09 13:51:04 -10:00
Teemu R
510aea7207
Release 0.6.0.dev1 (#624) 2024-01-05 02:34:56 +01:00
Nathan Wreggit
cfe694e5de
Get child emeters with CLI (#623)
* Get child emeters with CLI

* Avoid extra IO when not que querying the child emeter
2024-01-05 02:25:24 +01:00
Teemu R
2d8a8d9511
Add update-credentials command (#620)
* Add change credentials command

* Rename command and add prompts for credential update
2024-01-05 02:25:15 +01:00
J. Nick Koston
554fe0a96e
Avoid linear search for emeter realtime and emeter_today (#622)
* Avoid linear search for emeter realtime and emeter_today

Most of the time the data we want is at the end of the
list so we now search backwards to avoid having to
scale all the data and throw most of it away

* more tweaks

* coverage

* coverage

* preen

* coverage

* branch cover
2024-01-05 02:01:00 +01:00
J. Nick Koston
efd67b9261
Add P125M and update EP25 fixtures (#621)
* Add P125M and update EP25 fixtures

* fix: adjust tests
2024-01-05 00:01:34 +01:00
Teemu R
17d96064c2
Mark L900-5 as supported (#617)
* Add fixture for L900-5

* Update readme
2024-01-04 19:52:11 +01:00
Teemu R
7e6eaf4ab2
Use consistent envvars for dump_devinfo credentials (#618) 2024-01-04 19:28:59 +01:00
Teemu R
7a3eedeee9
Check the ct range for color temp support (#619) 2024-01-04 19:28:48 +01:00
sdb9696
b156defc3c
Fix cli discover bug with None username/password (#615) 2024-01-04 19:17:48 +01:00
Teemu R
1bb930b096
Ship CHANGELOG only in sdist (#610)
Otherwise, the file would be extracted in the main site-packages which is rather unexpected..

Uninstalling python-kasa-0.6.0.dev0:
  Would remove:
    /home/tpr/.virtualenvs/default/bin/kasa
    /home/tpr/.virtualenvs/default/lib/python3.11/site-packages/CHANGELOG.md
    /home/tpr/.virtualenvs/default/lib/python3.11/site-packages/kasa/*
    /home/tpr/.virtualenvs/default/lib/python3.11/site-packages/python_kasa-0.6.0.dev0.dist-info/*
Proceed (Y/n)?
2024-01-04 19:14:14 +01:00
Teemu R
047a84b60a
Release 0.6.0.dev0 (#609) 2024-01-04 00:28:29 +01:00
sdb9696
e9bf9f58ee
Allow serializing and passing of credentials_hashes in DeviceConfig (#607)
* Allow passing of credentials_hashes in DeviceConfig

* Update following review
2024-01-03 22:46:08 +01:00
Teemu R
3692e4812f
Implement wifi interface for tapodevice (#606)
* Implement wifi interface for tapodevice

* Implement wifi_join

Tested to work on P110

* Fix linting
2024-01-03 22:45:16 +01:00
gimpy88
c810298b04
Add support for KS205 and KS225 wall switches (#594)
* KS205 Fixture

* KS225 Fixture

* Added Smart.KasaSwitch device type

* Added KS225 to test

* Added variable color temp check

* Added supported devices to readme

* Removed parenthesis

* Updated fixtures

* Fixed for ruff
2024-01-03 19:31:42 +01:00
Teemu R
30c4e6a6a3
Cleanup credentials handling (#605)
* credentials: don't allow none to simplify checks

* Implement __bool__ for credentials

* Cleanup klaptransport cred usage

* Cleanup deviceconfig and tapodevice

* fix linting

* Pass dummy credentials for tests

* Remove __bool__ dunder and add docs to credentials

* Check for cred noneness in tapodevice.update()
2024-01-03 19:26:52 +01:00
Teemu R
10fc2c3c54
Pull up emeter handling to tapodevice base class (#601)
* Pull has_emeter property up to tapodevice base class

This will also use the existence of energy_monitoring in the component_nego query to decide if the device has the service.

* Move emeter related functions to tapodevice

* Remove supported_modules override for now

This should be done in a separate PR, if we want to expose the available components to cli and downstreams

* Dedent extra reqs

* Move extra_reqs initialization

* Fix tests
2024-01-03 19:04:34 +01:00
Teemu R
864ea92ece
Update P110(EU) fixture (#604) 2024-01-02 19:34:39 +01:00
Teemu R
9a2b513e6a
Update L530 aes fixture (#603) 2024-01-02 18:49:52 +01:00
sdb9696
ae5ad3e8c6
Add known smart requests to dump_devinfo (#597)
* Add known smart requests to dump_devinfo

* Move smartrequest.py to devtools

* Update post-review
2024-01-02 18:20:53 +01:00
Teemu R
5dafc1d1ed
Cleanup custom exception kwarg handling (#602)
* Cleanup custom exceptions

* Read custom keyword arguments from kwargs
* Pass all input args to the super

Earlier behavior:
Got error: AuthenticationException((('Error logging in: 192.168.xx.xx: LOGIN_ERROR(-1501)',), <SmartErrorCode.LOGIN_ERROR: -1501>))

New behavior:
Got error: AuthenticationException('Error logging in: 192.168.xx.xx: LOGIN_ERROR(-1501)')

* Pass UnsupportedDeviceException kwargs to parent, too
2024-01-02 16:24:09 +01:00
sdb9696
7646bc4542
Update P110(UK) fixture (#596) 2023-12-31 15:36:15 +01:00
sdb9696
fd9b3cd04c
Add L530(EU) klap fixture (#598) 2023-12-31 15:35:43 +01:00
sdb9696
1b7914277d
Fix dump_devinfo for unauthenticated (#593) 2023-12-29 20:42:02 +01:00
sdb9696
f6fd898faf
Add DeviceConfig to allow specifying configuration parameters (#569)
* Add DeviceConfig handling

* Update post review

* Further update post latest review

* Update following latest review

* Update docstrings and docs
2023-12-29 20:17:15 +01:00
alanblake
ec3ea39a37
Fix typo in cli.rst (#581) 2023-12-29 16:05:47 +01:00
Teemu R
1d5a9c35f4
Elevate --verbose to top-level option (#590)
* Elevate --verbose to be usable for all commands

* Fix tests
2023-12-29 16:04:41 +01:00
sdb9696
b66347116f
Add optional error code to exceptions (#585) 2023-12-20 20:16:23 +01:00
sdb9696
6819c746d7
Enable multiple requests in smartprotocol (#584)
* Enable multiple requests in smartprotocol

* Update following review

* Remove error_code parameter in exceptions
2023-12-20 18:08:04 +01:00
sdb9696
20ea6700a5
Do login entirely within AesTransport (#580)
* Do login entirely within AesTransport

* Remove login and handshake attributes from BaseTransport

* Add AesTransport tests

* Synchronise transport and protocol __init__ signatures and rename internal variables

* Update after review
2023-12-19 15:11:59 +01:00
sdb9696
209391c422
Improve CLI Discovery output (#583)
- 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.
2023-12-19 13:50:33 +01:00
sdb9696
2e6c41d039
Improve smartprotocol error handling and retries (#578)
* Improve smartprotocol error handling and retries

* Update after review

* Enum to IntEnum and SLEEP_SECONDS_AFTER_TIMEOUT
2023-12-10 16:41:53 +01:00
Teemu R
a77af5fb3b
Request component_nego only once for tapodevice (#576)
Optimizes the update cycle a bit, as it's doubtful the components change over time
2023-12-10 00:32:30 +01:00
Teemu R
35a452168a
Log smartprotocol requests (#575)
* Log smartprotocol requests

Also, comment out encrypted secure_passthrough response for the time being

* Fix linting
2023-12-08 15:22:58 +01:00
Teemu R
1e2241ee95
Fix hsv setting for tapobulb (#573)
This fixes changing the color for L530:
* If color temp is set on the device, it overrides any hue/sat settings. We override it to zero which seems to work.
* L530 does not allow None/null for brightness, so we avoid passing it on to the device.
2023-12-08 15:16:45 +01:00
sdb9696
16ba87378d
Add EP25 smart fixture and improve test framework for SMART devices (#572) 2023-12-08 14:55:14 +01:00
sdb9696
b27a31a8a9
Add new methods to dump_devinfo and mask aliases (#574) 2023-12-08 14:29:07 +01:00
Steven Bytnar
be289a5751
Add KP125M fixture and allow passing credentials for tests (#567)
* Add KP125M fixture. Enable tapo auth in pytest.

* authentication is not just for tapo

* Use "##MASKEDNAME##" base64 for nickname and ssid.

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2023-12-08 00:04:50 +01:00
Teemu R
bd23d61687
Update readme with clearer instructions, tapo support (#571)
* Update readme with clearer instructions, tapo support

All in all, making the readme more approachable landing page:

* Link to provisioning docs from the beginning
* Hints about support for tapo devices
* Add some documentation about how to pass credentials
* Clearer usage instructions and links to find more information

* Lint
2023-12-06 22:54:14 +01:00
Teemu R
8cdd4f59f8
Use consistent naming for cli envvars (#570)
* Use consistent naming for cli envvars

* Fix linting
2023-12-05 23:20:29 +01:00
Teemu R
f9b5003da2
Add support for tapo bulbs (#558)
* Add support for tapo light bulbs

* Use TapoDevice for on/off

* Add tapobulbs to discovery

* Add partial support for effects

Activating the effect does not work as I thought it would,
but this implements rest of the interface from SmartLightStrip.

* Add missing __init__ for tapo package

* Make mypy happy

* Add docstrings to make ruff happy

* Implement state_information and has_emeter

* Import tapoplug from kasa.tapo package

* Add tapo L530 fixture

* Enable tests for L530 fixture

* Make ruff happy

* Update fixture filename

* Raise exceptions on invalid parameters

* Return results in a wrapped dict

* Implement set_*

* Reorganize bulbs to iot&smart, fix tests for smarts

* Fix linting

* Fix BULBS_LIGHT_STRIP back to LIGHT_STRIPS
2023-12-05 20:07:10 +01:00
Teemu R
5febd300ca
Add P110 fixture (#562)
* Add P110 fixture

* Move the fixture file to smart subdir

* Update fixture to have the region info

* Rename the fixture file to follow the convention
2023-12-05 16:58:25 +01:00
sdb9696
5e2fcd2cca
Re-add regional suffix to TAPO/SMART fixtures (#566) 2023-12-05 16:45:09 +01:00
sdb9696
01f3827d73
Fix transport retries after close (#568) 2023-12-05 15:56:29 +01:00
sdb9696
4a00199506
Add klap support for TAPO protocol by splitting out Transports and Protocols (#557)
* Add support for TAPO/SMART KLAP and seperate transports from protocols

* Add tests and some review changes

* Update following review

* Updates following review
2023-12-04 19:50:05 +01:00
Teemu R
347cbfe3bd
Make timeout configurable for cli (#564) 2023-12-04 16:44:27 +01:00
Steven Bytnar
bfd1d6ae0a
Kasa KP125M basic emeter support (#560)
* Add KP125M basic emeter support.

* Reduce diff.

* PR Comments
2023-12-03 15:41:46 +01:00
sdb9696
a6b7d73d79
Update dump_devinfo to produce new TAPO/SMART fixtures (#561) 2023-12-02 17:33:35 +01:00