1004 Commits

Author SHA1 Message Date
Teemu R.
fe88b52e19
Fallback to other module data on get_energy_usage errors ()
- The `get_energy_usage` query can fail if the device time is not set because the response includes the device time.
- Make `get_energy_usage` an optional query response so the energy module can fall back to getting the power from `get_emeter_data` or `get_current_power` on error.
- Devices on `energy_monitoring` version 1 still fail as they have no additional queries to fall back to.
2024-12-20 08:53:07 +00:00
Steven B.
83eb73cc7f
Add rssi and signal_level to smartcam () 2024-12-20 06:16:18 +00:00
Steven B.
d890b0a3ac
Add smartcam detection modules ()
- Motion detection
- Person detection
- Tamper detection
- Baby Cry Detection
2024-12-20 00:22:08 +01:00
Steven B.
b5f49a3c8a
Fix lens mask required component and state ()
Fixes a few issues with the lens mask since migrating it into its own
module:

- The module didn't provide itself as the container and hence the
feature was accessing the same properties on the device.
- `enabled` getter on the module incorrect but not picked up due to the
previous issue.
- No `REQUIRED_COMPONENT` set to ensure the module only created if
available.

Also changes attribute names to `enabled` from `state` to avoid
confusion with device states.
2024-12-19 14:52:25 +01:00
Steven B.
b78e09caa0
Add TC70 3.0 1.3.11 fixture ()
Many thanks to @allanbeth for the fixture!
2024-12-19 14:48:03 +01:00
Steven B.
47934dbf96
Add C325WB(EU) 1.0 1.1.17 Fixture () 2024-12-18 11:43:20 +00:00
Steven B.
ba273f308e
Add LensMask module to smartcam ()
Ensures no error with devices that do not have the `lens_mask` component.
2024-12-17 20:15:42 +00:00
Teemu R.
37ef7b0463
cli: print model, https, and lv for discover list ()
```
kasa --target 192.168.xx.xx discover list

HOST            MODEL     DEVICE FAMILY        ENCRYPT HTTPS LV  ALIAS
192.168.xxx.xxx KP115(EU) IOT.SMARTPLUGSWITCH  XOR     0     -   Fridge
192.168.xxx.xxx L900-5    SMART.TAPOBULB       KLAP    0     2   L900
192.168.xxx.xxx P115      SMART.TAPOPLUG       AES     0     2   Nightdesk
192.168.xxx.xxx TC65      SMART.IPCAMERA       AES     1     2   Tapo_TC65_B593

```

Also handles `TimeoutError` and `Exception` during `update()`

---------

Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2024-12-17 21:09:17 +01:00
Steven B.
14d5629de1
Update C520WS fixture with new methods () 2024-12-17 10:59:57 +00:00
Steven B.
c6c4490a49
Add C100 4.0 1.3.14 Fixture () 2024-12-17 10:59:24 +00:00
Steven B.
fe072657b4
Simplify get_protocol to prevent clashes with smartcam and robovac () 2024-12-17 07:39:17 +00:00
Steven B.
5918e4daa7
Enable saving of fixture files without git clone ()
Allows `dump_devinfo` to be run without fixture subfolders present from cloned repository
2024-12-16 13:42:42 +00:00
Steven B.
d03a387a74
Add new methods to dump_devinfo ()
Adds `getMatterSetupInfo`, `getConnectStatus` and `scanApList`
2024-12-16 13:06:26 +00:00
Steven B.
e206d9b4df
Miscellaneous minor fixes to dump_devinfo ()
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 () 2024-12-16 13:48:27 +01:00
Steven B.
e9109447a7
Add smartcam modules to package inits () 2024-12-16 13:20:26 +01:00
Steven B.
031ebcd97f
Update docs for Tapo Lab Third-Party compatibility () 2024-12-16 13:19:25 +01:00
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)
0.8.1
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