Commit Graph

36 Commits

Author SHA1 Message Date
Steven B.
2bda54fcb1
Rename smartcamera to smartcam (#1300) 2024-11-23 09:07:47 +01:00
Teemu R.
f2ba23301a
Make discovery on unsupported devices less noisy (#1291) 2024-11-21 18:22:54 +00:00
Steven B.
e209d40a6d
Use _get_device_info methods for smart and iot devs in devtools (#1265) 2024-11-18 14:53:11 +00:00
Steven B.
6213b90f62
Move TAPO smartcamera out of experimental package (#1255)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-11-13 19:59:42 +00:00
Steven B.
e55731c110
Move protocol modules into protocols package (#1254) 2024-11-13 17:50:21 +00:00
Teemu R.
668ba748c5
Move transports into their own package (#1247)
This moves all transport implementations into a new `transports` package
for cleaner main package & easier to understand project structure.
2024-11-12 14:40:44 +01:00
Teemu R.
66eb17057e
Enable ruff check for ANN (#1139) 2024-11-10 18:55:13 +00:00
Steven B.
77b654a9aa
Update try_connect_all to be more efficient and report attempts (#1222) 2024-11-01 18:17:18 +00:00
Steven B.
4aec9d302f
Allow enabling experimental devices from environment variable (#1194) 2024-10-29 09:30:30 +00:00
Steven B.
048c84d72c
Add https parameter to device class factory (#1184)
`SMART.TAPOHUB` resolves to different device classes based on the https value
2024-10-22 18:09:35 +01:00
Steven B.
dcc36e1dfe
Initial TapoCamera support (#1165)
Adds experimental support for the Tapo Camera protocol also used by the H200 hub.
Creates a new SslAesTransport and a derived SmartCamera and SmartCameraProtocol.
2024-10-16 16:53:52 +01:00
Steven B.
81e2685605
Send empty dictionary instead of null for iot queries (#1145) 2024-10-01 12:47:36 +01:00
Teemu R.
3e43781bb2
Add flake8-logging (LOG) and flake8-logging-format (G) for ruff (#1104)
Enables rules LOG (flake8-logging) and G (flake8-logging-format) for
ruff. This will catch eager log message formatting, among other similar
issues.
2024-08-30 16:13:14 +02:00
Steven B
d3544b4989
Move SmartBulb into SmartDevice (#874) 2024-04-29 18:19:44 +01:00
Teemu R
10629f2db9
Be more lax on unknown SMART devices (#863) 2024-04-25 07:36:30 +01:00
Adrian Dörr
0ab7436eef
Add support for KH100 hub (#847)
Add SMART.KASAHUB to the map of supported devices.
This also adds fixture files for KH100, KE100, and T310, and adapts affected modules and their tests accordingly.

---------

Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2024-04-22 16:24:15 +02:00
Steven B
203bd79253
Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
Steven B
da441bc697
Update poetry locks and pre-commit hooks (#837)
Also updates CI pypy versions to be 3.9 and 3.10 which are the currently
[supported
versions](https://www.pypy.org/posts/2024/01/pypy-v7315-release.html).
Otherwise latest cryptography doesn't ship with pypy3.8 wheels and is
unable to build on windows.

Also updates the `codecov-action` to v4 which fixed some intermittent
uploading errors.
2024-04-16 20:21:20 +02:00
Steven B
fcad0d2344
Add WallSwitch device type and autogenerate supported devices docs (#758) 2024-03-01 18:32:45 +00:00
Teemu R
bc65f96f85
Add initial support for H100 and T315 (#776)
Adds initial support for H100 and its alarmmodule.

Also implements the following modules for T315:
* reportmodule (reporting interval)
* battery
* humidity
* temperature
2024-02-22 23:09:38 +01:00
Teemu R
d9d2f1a430
Remove SmartPlug in favor of SmartDevice (#781)
With the move towards autodetecting available features, there is no reason to keep SmartPlug around.

kasa.smart.SmartPlug is removed in favor of kasa.smart.SmartDevice which offers the same functionality.
Information about auto_off can be accessed using Features of the AutoOffModule on supported devices.

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-02-22 14:34:55 +01:00
Steven B
8c39e81a40
Rename and deprecate exception classes (#739)
# Public #
SmartDeviceException -> KasaException
UnsupportedDeviceException(SmartDeviceException) -> UnsupportedDeviceError(KasaException)
TimeoutException(SmartDeviceException, asyncio.TimeoutError) -> TimeoutError(KasaException, asyncio.TimeoutError)

Add new exception for error codes -> DeviceError(KasaException)
AuthenticationException(SmartDeviceException) -> AuthenticationError(DeviceError)

# Internal #
RetryableException(SmartDeviceException) -> _RetryableError(DeviceError)
ConnectionException(SmartDeviceException) -> _ConnectionError(KasaException)
2024-02-21 16:52:55 +01:00
Steven B
45f251e57e
Ensure connections are closed when cli is finished (#752)
* Ensure connections are closed when cli is finished

* Test for close calls on error and success
2024-02-14 17:03:50 +00:00
Steven B
0d119e63d0
Refactor devices into subpackages and deprecate old names (#716)
* Refactor devices into subpackages and deprecate old names

* Tweak and add tests

* Fix linting

* Remove duplicate implementations affecting project coverage

* Update post review

* Add device base class attributes and rename subclasses

* Rename Module to BaseModule

* Remove has_emeter_history

* Fix missing _time in init

* Update post review

* Fix test_readmeexamples

* Fix erroneously duped files

* Clean up iot and smart imports

* Update post latest review

* Tweak Device docstring
2024-02-04 16:20:08 +01:00
Steven B
0d0f56414c
Switch from TPLinkSmartHomeProtocol to IotProtocol/XorTransport (#710)
* Switch from TPLinkSmartHomeProtocol to IotProtocol/XorTransport

* Add test

* Update docs

* Fix ruff deleting deprecated import
2024-01-26 09:11:31 +00:00
J. Nick Koston
cba073ebde
Add support for tapo wall switches (S500D) (#704)
* Add support for the S500D

* tweak

* Update README.md
2024-01-25 08:54:56 +01:00
Steven B
14acc8550e
Rename base TPLinkProtocol to BaseProtocol (#669) 2024-01-22 16:28:30 +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
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
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
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
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
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
sdb9696
63d64ad920
Add support for the protocol used by TAPO devices and some newer KASA devices. (#552)
* Add Tapo protocol support

* Update get_device_instance and test_unsupported following review
2023-11-30 13:10:49 +01:00
sdb9696
9728866afb
Re-add protocol_class parameter to connect (#551)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-11-28 20:13:15 +01:00
J. Nick Koston
e98252ff17
Move connect_single to SmartDevice.connect (#538)
This refactors `Discover.connect_single` by moving device instance construction into a separate device factory module.
New `SmartDevice.connect(host, *, port, timeout, credentials, device_type)` class method replaces the functionality of `connect_single`,
and also now allows constructing device instances without relying on UDP discovery for type discovery if `device_type` parameter is set.

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2023-11-21 23:48:53 +01:00