Steven B.
5918e4daa7
Enable saving of fixture files without git clone ( #1375 )
...
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Waiting to run
Allows `dump_devinfo` to be run without fixture subfolders present from cloned repository
2024-12-16 13:42:42 +00:00
Steven B.
e206d9b4df
Miscellaneous minor fixes to dump_devinfo ( #1382 )
...
Fixes:
- Decrypted discovery data saved under `discovery_result` instead of `result`
- `smart` child data not redacted
- `smartcam` child component list `device_id` not `SCRUBBED`
2024-12-16 13:00:28 +00:00
Steven B.
62345be916
Add timeout parameter to dump_devinfo ( #1381 )
2024-12-16 13:48:27 +01:00
Steven B.
8cb5c2e180
Update dump_devinfo for raw discovery json and common redactors ( #1358 )
...
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Has been cancelled
This PR does a few related things to dump_devinfo:
- Store the raw discovery result in the fixture.
- Consolidate redaction logic so it's not duplicated in dump_devinfo.
- Update existing fixtures to:
- Store raw discovery result under `result`
- Use `SCRUBBED_CHILD_DEVICE_ID` everywhere
- Have correct values as per the consolidated redactors.
2024-12-11 14:18:44 +01:00
Teemu R.
74b59d7f98
Scrub more vacuum keys ( #1328 )
2024-12-01 18:07:05 +01:00
Teemu R.
d122b48788
Add vacuum component queries to dump_devinfo ( #1320 )
2024-11-29 19:02:04 +00:00
Steven B.
2bda54fcb1
Rename smartcamera to smartcam ( #1300 )
2024-11-23 09:07:47 +01:00
Steven B.
f4316110c9
Move iot fixtures into iot subfolder ( #1299 )
2024-11-22 21:19:33 +01:00
Ryan Nitcher
c5830a4cdc
Add PIR ADC Values to Test Fixtures ( #1296 )
2024-11-22 07:59:17 +00:00
Steven B.
0e5013d4b4
dump_devinfo: iot light strip commands ( #1286 )
2024-11-20 15:06:59 +01:00
Teemu R.
bbe68a5fe9
dump_devinfo: query smartlife.iot.common.cloud for fw updates ( #1284 )
2024-11-20 13:07:02 +00:00
Steven B.
bf23f73cce
Extend dump_devinfo iot queries ( #1278 )
2024-11-20 00:36:16 +01:00
Steven B.
a01247d48f
Remove support for python <3.11 ( #1273 )
...
Python 3.11 ships with latest Debian Bookworm.
pypy is not that widely used with this library based on statistics. It could be added back when pypy supports python 3.11.
2024-11-18 18:46:36 +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.
5fe75cada9
Add smartcamera devices to supported docs ( #1257 )
...
The library now officially supports H200, C200 and TC65
2024-11-14 18:28:30 +00:00
Steven B.
b8f6651d9b
Remove experimental support ( #1256 )
2024-11-14 15:55:02 +01: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
Steven B.
254a9af5c1
Update DiscoveryResult to use Mashumaro instead of pydantic ( #1231 )
...
Mashumaro is faster and doesn't come with all versioning problems that
pydantic does.
A basic perf test deserializing all of our discovery results fixtures
shows mashumaro as being about 6 times faster deserializing dicts than
pydantic. It's much faster parsing from a json string but that's likely
because it uses orjson under the hood although that's not really our use
case at the moment.
```
PYDANTIC - ms
=================
json dict
-----------------
4.7665 1.3268
3.1548 1.5922
3.1130 1.8039
4.2834 2.7606
2.0669 1.3757
2.0163 1.6377
3.1667 1.3561
4.1296 2.7297
2.0132 1.3471
4.0648 1.4105
MASHUMARO - ms
=================
json dict
-----------------
0.5977 0.5543
0.5336 0.2983
0.3955 0.2549
0.6516 0.2742
0.5386 0.2706
0.6678 0.2580
0.4120 0.2511
0.3836 0.2472
0.4020 0.2465
0.4268 0.2487
```
2024-11-12 22:00:04 +01:00
Steven B.
32671da9e9
Move tests folder to top level of project ( #1242 )
2024-11-11 10:11:31 +00:00
Steven B.
7483411ca2
Add trigger_logs and double_click to dump_devinfo helper ( #1208 )
2024-10-29 09:50:27 +00:00
Steven B.
4aec9d302f
Allow enabling experimental devices from environment variable ( #1194 )
2024-10-29 09:30:30 +00:00
Teemu R.
d30d116f37
dump_devinfo: query get_current_brt for iot dimmers ( #1209 )
2024-10-29 10:30:13 +01:00
Teemu R.
0287606235
Add TC65 fixture ( #1200 )
2024-10-28 13:47:24 +01:00
Steven B.
8ee8c17bdc
Update smartcamera to support single get/set/do requests ( #1187 )
...
Not supported by H200 hub
2024-10-24 13:11:28 +01:00
Steven B.
acd0202cab
Update dump_devinfo for smart camera protocol ( #1169 )
...
Introduces the child camera protocol wrapper, required to get the child device info with the new protocol.
2024-10-18 12:06:22 +01:00
Steven B.
81e2685605
Send empty dictionary instead of null for iot queries ( #1145 )
2024-10-01 12:47:36 +01:00
Steven B
be5202ccb7
Make device initialisation easier by reducing required imports ( #936 )
...
Adds username and password arguments to discovery to remove the need to import Credentials.
Creates TypeAliases in Device for connection configuration classes and DeviceType.
Using the API with these changes will only require importing either Discover or Device
depending on whether using Discover.discover() or Device.connect() to
initialize and interact with the API.
2024-06-03 19:06:54 +01:00
Teemu R
30e37038d7
Fix passing custom port for dump_devinfo ( #938 )
2024-06-03 16:46:38 +01:00
Teemu R
88381f270f
Use Path.save for saving the fixtures ( #894 )
...
This might fix saving of fixture files on Windows, but it's a good
practice to use pathlib where possible.
2024-05-03 13:57:43 +02:00
Steven B
6724506fab
Update dump_devinfo to print original exception stack on errors. ( #882 )
2024-04-29 14:33:46 +01:00
Steven B
03a0ef3cc3
Include component_nego with child fixtures ( #858 )
2024-04-22 19:17:11 +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
ced879498b
Put child fixtures in subfolder ( #809 )
...
This should prevent child fixtures from hubs breaking tests due to
missing discovery info. To get these devices in `filter_fixtures`
include protocol string of `SMART.CHILD`.
2024-03-06 15:54:55 +01:00
Steven B
24344b71f5
Update dump_devinfo to collect child device info ( #796 )
...
Will create separate fixture files if the model of the child devices
differs from the parent (i.e. hubs). Otherwise the child device info
will be under `child_devices`
2024-02-28 17:04:57 +01:00
Teemu R
a73e2a9ede
Add H100 fixtures ( #737 )
...
One direct out of the box, another with upgraded fw & t315
2024-02-24 00:12:19 +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
Teemu R
e86dcb6bf5
Fix dump_devinfo scrubbing for ks240 ( #765 )
2024-02-19 00:08:39 +01:00
Steven B
57835276e3
Fix devtools for P100 and add fixture ( #753 )
2024-02-14 19:43:10 +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
Teemu R
1acf4e86da
Retain last two chars for children device_id ( #733 )
2024-02-01 19:27:01 +01:00
Steven B
f7c04bcef8
Add --batch-size hint to timeout errors in dump_devinfo ( #696 )
...
* Add --batch-size hint to timeout errors in dump_devinfo
* Add _echo_error function for displaying critical errors
2024-01-24 10:40:36 +01:00
Steven B
1db955b05e
Make request batch size configurable and avoid multiRequest if 1 ( #681 )
2024-01-23 11:33:07 +01:00
Teemu R
f77e87dc5d
dump_devinfo improvements ( #657 )
...
* dump_devinfo improvements
* Scrub only the last three bytes for mac addresses
* Add --target to allow creating fixtures based on discovery
* Save fixtures directly to correct location, add --basedir to allow defining the location of repository root
* Add --autosave to disable prompting for saving
* Update fixtures for devices I have
* Add fixture for HS110 hw 4.0 fw 1.0.4
* Improve help strings
* Fix tests
* Update devtools README
* Default to discovery if no host/target given
2024-01-20 14:20:08 +01:00
Steven B
897db674c2
Add L900-10 fixture and it's additional component requests ( #629 )
2024-01-10 19:40:36 +01:00
Teemu R
7e6eaf4ab2
Use consistent envvars for dump_devinfo credentials ( #618 )
2024-01-04 19:28:59 +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
sdb9696
1b7914277d
Fix dump_devinfo for unauthenticated ( #593 )
2023-12-29 20:42:02 +01:00
sdb9696
b27a31a8a9
Add new methods to dump_devinfo and mask aliases ( #574 )
2023-12-08 14:29:07 +01:00