Commit Graph

1037 Commits

Author SHA1 Message Date
Steven B.
f8503e4df6
Force single for some smartcam requests ()
`onboarding` requests do not return the method key and need to be sent as single requests.
2024-12-15 16:03:12 +00:00
Steven B.
c439530f93
Add bare bones homekit modules smart and smartcam devices () 2024-12-14 13:34:58 +00:00
Steven B.
59e5073509
Update docs for new FeatureAttribute behaviour ()
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-12-13 22:23:58 +01:00
Steven B.
2ca6d3ebe9
Add bare-bones matter modules to smart and smartcam devices () 2024-12-13 19:45:38 +00:00
Steven B.
223f3318ea
Use DeviceInfo consistently across devices ()
- Make model exclude region for `iot` devices. This is consistent with `smart` and `smartcam` devices.
- Make region it's own attribute on `Device`.
- Ensure that devices consistently use `_get_device_info` static methods for all information relating to device models.
- Fix issue with firmware and hardware being the wrong way round for `smartcam` devices.
2024-12-13 12:37:13 +00:00
Teemu R.
5f84c69774
Add homebridge-kasa-python link to README () 2024-12-12 09:51:45 +00:00
Steven B.
7709bb967f
Update cli, light modules, and docs to use FeatureAttributes () 2024-12-11 15:53:35 +00:00
Steven B.
f8a46f74cd
Pass raw components to SmartChildDevice init ()
Clean up and consolidate the processing of raw component query responses and simplify the code paths for creating smartcam child devices when supported.
2024-12-11 14:38:38 +00:00
Steven B.
8cb5c2e180
Update dump_devinfo for raw discovery json and common redactors ()
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.
032cd5d2cc
Improve overheat reporting ()
Different devices and different firmwares report overheated status in
different ways.
Some devices indicate support for `overheat_protect` component, but
there are devices that report `overheat_status` even when it is not
listed.
Some other devices use `overheated` boolean that was already previously
supported, but this PR adds support for much more devices that use
`overheat_status` for reporting.

The "overheated" feature is moved into its own module, and uses either
of the ways to report this information.
This will also rename `REQUIRED_KEY_ON_PARENT` to `SYSINFO_LOOKUP_KEYS`
and change its logic to check if any of the keys in the list are found
in the sysinfo.

```
tpr@lumipyry ~/c/p/tests (fix/overheated)> ag 'overheat_protect' -c|wc -l
15
tpr@lumipyry ~/c/p/tests (fix/overheated)> ag 'overheated' -c|wc -l
38
tpr@lumipyry ~/c/p/tests (fix/overheated)> ag 'overheat_status' -c|wc -l
20
```

---------

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-12-11 01:01:36 +01:00
Steven B.
bf8f0adabe
Return raw discovery result in cli discover raw ()
Add `on_discovered_raw` callback to Discover and adds a cli command `discover raw` which returns the raw json before serializing to a `DiscoveryResult` and attempting to create a device class.
2024-12-10 22:42:14 +00:00
Steven B.
464683e09b
Tweak RELEASING.md instructions for patch releases () 2024-12-10 22:23:04 +01:00
Steven B.
ed0481918c
Fix line endings in device_fixtures.py () 2024-12-10 08:37:57 +00:00
ZeliardM
2f87ccd201
Add KS200 (US) IOT Fixture and P115 (US) Smart Fixture () 2024-12-10 06:14:17 +00:00
Happy-Cadaver
fd74b07e2c
Add C520WS camera fixture ()
Adding the C520WS fixture file

---------

Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2024-12-10 00:24:27 +01:00
Puxtril
cb89342be1
Add LinkieTransportV2 and basic IOT.IPCAMERA support ()
Add LinkieTransportV2 transport used by kasa cameras and a basic
implementation for IOT.IPCAMERA (kasacam) devices.

---------

Co-authored-by: Zach Price <pricezt@ornl.gov>
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
2024-12-07 00:06:58 +01:00
Steven B.
6d9b4421fe
Merge patch into master () 2024-12-06 12:01:24 +00:00
Steven B
7b9fe7f693
Merge patch into local master 2024-12-06 11:51:26 +00:00
Steven B.
611cd66266
0.8.1 ()
## [0.8.1](https://github.com/python-kasa/python-kasa/tree/0.8.1) (2024-12-06)

This patch release fixes some issues with newly supported smartcam devices.

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

**Fixed bugs:**

- Fix update errors on hubs with unsupported children [\#1344](https://github.com/python-kasa/python-kasa/pull/1344) (@sdb9696)
- Fix smartcam missing device id [\#1343](https://github.com/python-kasa/python-kasa/pull/1343) (@sdb9696)
2024-12-06 11:36:51 +00:00
Steven B
5a596dbcc9
Prepare 0.8.1 2024-12-06 11:18:48 +00:00
Steven B.
5465b66dee
Fix update errors on hubs with unsupported children () 2024-12-06 11:07:28 +00:00
Steven B.
7e8b83edb9
Fix smartcam missing device id () 2024-12-06 11:07:22 +00:00
Steven B.
be8b7139b8
Fix update errors on hubs with unsupported children () 2024-12-06 11:01:44 +00:00
Steven B.
1c9ee4d537
Fix smartcam missing device id () 2024-12-06 09:40:44 +00:00
Steven B.
8814d94989
Provide alternative camera urls () 2024-12-05 16:49:35 +00:00
Steven B.
4eed945e00
Do not error when accessing smart device_type before update () 2024-12-05 09:14:45 +00:00
Teemu R.
123ea107b1
Add link to related homeassistant-tapo-control () 2024-12-02 16:38:20 +01:00
Teemu R.
74b59d7f98
Scrub more vacuum keys () 2024-12-01 18:07:05 +01:00
Teemu R.
9966c6094a
Add ssltransport for robovacs ()
This PR implements a clear-text, token-based transport protocol seen on
RV30 Plus ().

- Client sends `{"username": "email@example.com", "password":
md5(password)}` and gets back a token in the response
- Rest of the communications are done with POST at `/app?token=<token>`

---------

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-12-01 18:06:48 +01:00
Teemu R.
9a52056522
Remove unnecessary check for python <3.10 () 2024-11-30 15:35:38 +00:00
Teemu R.
d122b48788
Add vacuum component queries to dump_devinfo () 2024-11-29 19:02:04 +00:00
Steven B.
5ef8f21b4d
Handle missing mgt_encryption_schm in discovery () 2024-11-29 15:23:16 +00:00
Teemu R.
fcb604e435
Follow main package structure for tests ()
* Transport tests under tests/transports/
* Protocol tests under tests/protocols/
* IOT tests under iot/
* Plus some minor cleanups, most code changes are related to splitting
up smart & iot tests
2024-11-28 17:56:20 +01:00
Steven B.
6adb2b5c28
Prepare 0.8.0 ()
## [0.8.0](https://github.com/python-kasa/python-kasa/tree/0.8.0) (2024-11-26)

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

**Release highlights:**

- **Initial support for devices using the Tapo camera protocol, i.e. Tapo cameras and the Tapo H200 hub.**
- New camera functionality such as exposing RTSP streaming urls and camera pan/tilt.
- New way of testing module support for individual features with `has_feature` and `get_feature`.
- Adding voltage and current monitoring to `smart` devices.
- Migration from pydantic to mashumaro for serialization.

Special thanks to @ryenitcher and @Puxtril for their new contributions to the improvement of the project! Also thanks to everyone who has helped with testing, contributing fixtures, and reporting issues!

**Breaking change notes:**

- Removed support for python <3.11. If you haven't got a compatible version try [uv](https://docs.astral.sh/uv/).
- Renamed `device_config.to_dict()` to `device_config.to_dict_control_credentials()`. `to_dict()` is still available but takes no parameters.
- From the `iot.Cloud` module the `iot.CloudInfo` class attributes have been converted to snake case.


**Breaking changes:**

- Migrate iot cloud module to mashumaro [\#1282](https://github.com/python-kasa/python-kasa/pull/1282) (@sdb9696)
- Replace custom deviceconfig serialization with mashumaru [\#1274](https://github.com/python-kasa/python-kasa/pull/1274) (@sdb9696)
- Remove support for python \<3.11 [\#1273](https://github.com/python-kasa/python-kasa/pull/1273) (@sdb9696)

**Implemented enhancements:**

- Update cli modify presets to support smart devices [\#1295](https://github.com/python-kasa/python-kasa/pull/1295) (@sdb9696)
- Use credentials\_hash for smartcamera rtsp url [\#1293](https://github.com/python-kasa/python-kasa/pull/1293) (@sdb9696)
- Add voltage and current monitoring to smart Devices [\#1281](https://github.com/python-kasa/python-kasa/pull/1281) (@ryenitcher)
- Update cli feature command for actions not to require a value [\#1264](https://github.com/python-kasa/python-kasa/pull/1264) (@sdb9696)
- Add pan tilt camera module [\#1261](https://github.com/python-kasa/python-kasa/pull/1261) (@sdb9696)
- Add alarm module for smartcamera hubs [\#1258](https://github.com/python-kasa/python-kasa/pull/1258) (@sdb9696)
- Move TAPO smartcamera out of experimental package [\#1255](https://github.com/python-kasa/python-kasa/pull/1255) (@sdb9696)
- Add SmartCamera Led Module [\#1249](https://github.com/python-kasa/python-kasa/pull/1249) (@sdb9696)
- Use component queries to select smartcamera modules [\#1248](https://github.com/python-kasa/python-kasa/pull/1248) (@sdb9696)
- Print formatting for IotLightPreset [\#1216](https://github.com/python-kasa/python-kasa/pull/1216) (@Puxtril)
- Allow getting Annotated features from modules [\#1018](https://github.com/python-kasa/python-kasa/pull/1018) (@sdb9696)
- Add common Thermostat module [\#977](https://github.com/python-kasa/python-kasa/pull/977) (@sdb9696)

**Fixed bugs:**

- TP-Link Tapo S505D cannot disable gradual on/off  [\#1309](https://github.com/python-kasa/python-kasa/issues/1309)
- Inconsistent emeter information between features and emeter cli [\#1308](https://github.com/python-kasa/python-kasa/issues/1308)
- How to dump power usage after latest updates? [\#1306](https://github.com/python-kasa/python-kasa/issues/1306)
- kasa.discover: Got unsupported connection type: 'device\_family': 'SMART.IPCAMERA' [\#1267](https://github.com/python-kasa/python-kasa/issues/1267)
- device \_\_repr\_\_ fails if no sys\_info [\#1262](https://github.com/python-kasa/python-kasa/issues/1262)
- Tapo P110M: Error processing Energy for device, module will be unavailable: get\_energy\_usage for Energy  [\#1243](https://github.com/python-kasa/python-kasa/issues/1243)
- Listing light presets throws error [\#1201](https://github.com/python-kasa/python-kasa/issues/1201)
- Include duration when disabling smooth transition on/off [\#1313](https://github.com/python-kasa/python-kasa/pull/1313) (@rytilahti)
- Expose energy command to cli [\#1307](https://github.com/python-kasa/python-kasa/pull/1307) (@rytilahti)
- Make discovery on unsupported devices less noisy [\#1291](https://github.com/python-kasa/python-kasa/pull/1291) (@rytilahti)
- Fix repr for device created with no sysinfo or discovery info" [\#1266](https://github.com/python-kasa/python-kasa/pull/1266) (@sdb9696)
- Fix discovery by alias for smart devices [\#1260](https://github.com/python-kasa/python-kasa/pull/1260) (@sdb9696)
- Make \_\_repr\_\_ work on discovery info [\#1233](https://github.com/python-kasa/python-kasa/pull/1233) (@rytilahti)

**Added support for devices:**

- Add HS200 \(US\) Smart Fixture [\#1303](https://github.com/python-kasa/python-kasa/pull/1303) (@ZeliardM)
- Add smartcamera devices to supported docs [\#1257](https://github.com/python-kasa/python-kasa/pull/1257) (@sdb9696)
- Add P110M\(AU\) fixture [\#1244](https://github.com/python-kasa/python-kasa/pull/1244) (@rytilahti)
- Add L630 fixture [\#1240](https://github.com/python-kasa/python-kasa/pull/1240) (@rytilahti)
- Add EP40M Fixture [\#1238](https://github.com/python-kasa/python-kasa/pull/1238) (@ryenitcher)
- Add KS220 Fixture [\#1237](https://github.com/python-kasa/python-kasa/pull/1237) (@ryenitcher)

**Documentation updates:**

- Use markdown footnotes in supported.md [\#1310](https://github.com/python-kasa/python-kasa/pull/1310) (@sdb9696)
- Update docs for the new module attributes has/get feature [\#1301](https://github.com/python-kasa/python-kasa/pull/1301) (@sdb9696)
- Fixup contributing.md for running test against a real device [\#1236](https://github.com/python-kasa/python-kasa/pull/1236) (@sdb9696)

**Project maintenance:**

- Rename tests/smartcamera to tests/smartcam [\#1315](https://github.com/python-kasa/python-kasa/pull/1315) (@sdb9696)
- Do not error on smartcam hub attached smartcam child devices [\#1314](https://github.com/python-kasa/python-kasa/pull/1314) (@sdb9696)
- Add P110M\(EU\) fixture [\#1305](https://github.com/python-kasa/python-kasa/pull/1305) (@sdb9696)
- Run tests with caplog in a single worker [\#1304](https://github.com/python-kasa/python-kasa/pull/1304) (@sdb9696)
- Rename smartcamera to smartcam [\#1300](https://github.com/python-kasa/python-kasa/pull/1300) (@sdb9696)
- Move iot fixtures into iot subfolder [\#1299](https://github.com/python-kasa/python-kasa/pull/1299) (@sdb9696)
- Annotate fan\_speed\_level of Fan interface [\#1298](https://github.com/python-kasa/python-kasa/pull/1298) (@sdb9696)
- Add PIR ADC Values to Test Fixtures [\#1296](https://github.com/python-kasa/python-kasa/pull/1296) (@ryenitcher)
- Exclude \_\_getattr\_\_ for deprecated attributes from type checkers [\#1294](https://github.com/python-kasa/python-kasa/pull/1294) (@sdb9696)
- Simplify omit http\_client in DeviceConfig serialization [\#1292](https://github.com/python-kasa/python-kasa/pull/1292) (@sdb9696)
- Add SMART Voltage Monitoring to Fixtures [\#1290](https://github.com/python-kasa/python-kasa/pull/1290) (@ryenitcher)
- Remove pydantic dependency [\#1289](https://github.com/python-kasa/python-kasa/pull/1289) (@sdb9696)
- Do not print out all the fixture names at the start of test runs [\#1287](https://github.com/python-kasa/python-kasa/pull/1287) (@sdb9696)
- dump\_devinfo: iot light strip commands [\#1286](https://github.com/python-kasa/python-kasa/pull/1286) (@sdb9696)
- Migrate TurnOnBehaviours to mashumaro [\#1285](https://github.com/python-kasa/python-kasa/pull/1285) (@sdb9696)
- dump\_devinfo: query smartlife.iot.common.cloud for fw updates [\#1284](https://github.com/python-kasa/python-kasa/pull/1284) (@rytilahti)
- Migrate RuleModule to mashumaro [\#1283](https://github.com/python-kasa/python-kasa/pull/1283) (@sdb9696)
- Update sphinx dependency to 6.2 to fix docs build [\#1280](https://github.com/python-kasa/python-kasa/pull/1280) (@sdb9696)
- Update DiscoveryResult to use mashu Annotated Alias [\#1279](https://github.com/python-kasa/python-kasa/pull/1279) (@sdb9696)
- Extend dump\_devinfo iot queries [\#1278](https://github.com/python-kasa/python-kasa/pull/1278) (@sdb9696)
- Migrate triggerlogs to mashumaru [\#1277](https://github.com/python-kasa/python-kasa/pull/1277) (@sdb9696)
- Migrate smart firmware module to mashumaro [\#1276](https://github.com/python-kasa/python-kasa/pull/1276) (@sdb9696)
- Migrate IotLightPreset to mashumaru [\#1275](https://github.com/python-kasa/python-kasa/pull/1275) (@sdb9696)
- Allow callable coroutines for feature setters [\#1272](https://github.com/python-kasa/python-kasa/pull/1272) (@sdb9696)
- Fix deprecated SSLContext\(\) usage [\#1271](https://github.com/python-kasa/python-kasa/pull/1271) (@sdb9696)
- Use \_get\_device\_info methods for smart and iot devs in devtools [\#1265](https://github.com/python-kasa/python-kasa/pull/1265) (@sdb9696)
- Remove experimental support [\#1256](https://github.com/python-kasa/python-kasa/pull/1256) (@sdb9696)
- Move protocol modules into protocols package [\#1254](https://github.com/python-kasa/python-kasa/pull/1254) (@sdb9696)
- Add linkcheck to readthedocs CI [\#1253](https://github.com/python-kasa/python-kasa/pull/1253) (@rytilahti)
- Update cli energy command to use energy module [\#1252](https://github.com/python-kasa/python-kasa/pull/1252) (@sdb9696)
- Consolidate warnings for fixtures missing child devices [\#1251](https://github.com/python-kasa/python-kasa/pull/1251) (@sdb9696)
- Update smartcamera fixtures with components [\#1250](https://github.com/python-kasa/python-kasa/pull/1250) (@sdb9696)
- Move transports into their own package [\#1247](https://github.com/python-kasa/python-kasa/pull/1247) (@rytilahti)
- Fix warnings in our test suite [\#1246](https://github.com/python-kasa/python-kasa/pull/1246) (@rytilahti)
- Move tests folder to top level of project [\#1242](https://github.com/python-kasa/python-kasa/pull/1242) (@sdb9696)
- Fix test framework running against real devices [\#1235](https://github.com/python-kasa/python-kasa/pull/1235) (@sdb9696)
- Add Additional Firmware Test Fixures [\#1234](https://github.com/python-kasa/python-kasa/pull/1234) (@ryenitcher)
- Update DiscoveryResult to use Mashumaro instead of pydantic [\#1231](https://github.com/python-kasa/python-kasa/pull/1231) (@sdb9696)
- Update fixture for ES20M 1.0.11 [\#1215](https://github.com/python-kasa/python-kasa/pull/1215) (@rytilahti)
- Enable ruff check for ANN [\#1139](https://github.com/python-kasa/python-kasa/pull/1139) (@rytilahti)

**Closed issues:**

- Expose Fan speed range from the library [\#1008](https://github.com/python-kasa/python-kasa/issues/1008)
- \[META\] 0.7 series - module support for SMART devices, support for introspectable device features and refactoring the library [\#783](https://github.com/python-kasa/python-kasa/issues/783)
2024-11-26 12:10:02 +00:00
Steven B.
f71450b880
Do not error on smartcam hub attached smartcam child devices () 2024-11-26 11:37:14 +00:00
Steven B.
6c42b36865
Rename tests/smartcamera to tests/smartcam () 2024-11-26 11:36:30 +00:00
Teemu R.
0c755f7120
Include duration when disabling smooth transition on/off ()
Fixes 
2024-11-26 10:39:31 +00:00
Teemu R.
69e08c2385
Expose energy command to cli ()
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2024-11-26 09:42:55 +00:00
Steven B.
3dfada7575
Add common Thermostat module () 2024-11-26 09:37:15 +00:00
Steven B.
cb4e28394d
Update docs for the new module attributes has/get feature () 2024-11-26 08:38:20 +00:00
Steven B.
fe53cd7d9c
Use markdown footnotes in supported.md ()
Brings our markdown inline with the [HA
markdown](https://github.com/home-assistant/home-assistant.io/pull/33342#discussion_r1653484233)
2024-11-25 18:02:12 +01:00
Steven B.
15ecf320d9
Add P110M(EU) fixture () 2024-11-23 12:38:42 +00:00
ZeliardM
ea73b858e8
Add HS200 (US) Smart Fixture () 2024-11-23 12:31:27 +00:00
Teemu R.
d0a2ed7388
Add P110M(AU) fixture () 2024-11-23 12:30:39 +00:00
Steven B.
412c65c428
Run tests with caplog in a single worker () 2024-11-23 12:20:51 +00:00
Steven B.
2bda54fcb1
Rename smartcamera to smartcam () 2024-11-23 09:07:47 +01:00
Steven B.
b525d6a35c
Annotate fan_speed_level of Fan interface () 2024-11-22 21:21:29 +01:00
Steven B.
f4316110c9
Move iot fixtures into iot subfolder () 2024-11-22 21:19:33 +01:00
Ryan Nitcher
c5830a4cdc
Add PIR ADC Values to Test Fixtures () 2024-11-22 07:59:17 +00:00
Steven B.
37cc4da7b6
Allow getting Annotated features from modules ()
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-11-22 07:52:23 +00:00