663 Commits

Author SHA1 Message Date
DawidPietrykowski
fd6067e5a0
Add smartcam pet detection toggle module () 2025-01-18 12:58:26 +00:00
Teemu R.
980f6a38ca
Add childlock module for vacuums ()
Add new configuration feature:
```
Child lock (child_lock): False
```
---------

Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2025-01-17 12:15:51 +00:00
Teemu R.
773801cad5
Add setting to change carpet clean mode ()
Add new setting to control carpet clean mode:
```
== Configuration ==
Carpet clean mode (carpet_clean_mode): Normal *Boost*
```
2025-01-15 19:35:41 +00:00
Teemu R.
d27697c50f
Add ultra mode (fanspeed = 5) for vacuums () 2025-01-15 19:11:10 +00:00
Steven B.
b23019e748
Enable dynamic hub child creation and deletion on update () 2025-01-15 19:10:32 +00:00
Teemu R.
17356c10f1
Add mop module ()
Adds the following new features: a setting to control water level and a sensor if the mop is attached:
```
Mop water level (mop_waterlevel): *Disable* Low Medium High
Mop attached (mop_attached): True
```
2025-01-15 19:12:33 +01:00
Teemu R.
bc97c0794a
Add setting to change clean count ()
Adds a setting to change the number of times to clean:
```
== Configuration ==
Clean count (clean_count): 1 (range: 1-3)
```
2025-01-15 19:11:33 +01:00
Teemu R.
2ab42f59b3
Fallback to is_low for batterysensor's battery_low ()
Fallback to `is_low` if `at_low_battery` is not available.
2025-01-15 14:33:05 +01:00
Teemu R.
1355e85f8e
Expose current cleaning information ()
Add new sensors to show the current cleaning state:
```
Cleaning area (clean_area): 0 0
Cleaning time (clean_time): 0:00:00
Cleaning progress (clean_progress): 100 %
```
2025-01-15 14:20:19 +01:00
Steven B.
4e7e18cef1
Add battery module to smartcam devices () 2025-01-14 21:57:35 +00:00
Teemu R.
2542516009
Add vacuum speaker controls ()
Implements `speaker` and adds the following features:
* `volume`  to control the speaker volume
* `locate` to play "I'm here sound"
2025-01-14 16:48:34 +00:00
Teemu R.
3c98efb015
Implement vacuum dustbin module (dust_bucket) ()
Initial implementation for dustbin auto-emptying.

New features:
- `dustbin_empty` action to empty the dustbin immediately
- `dustbin_autocollection_enabled` to toggle the auto collection
- `dustbin_mode` to choose how often the auto collection is performed
2025-01-14 17:30:18 +01:00
Steven B.
68f50aa763
Allow update of camera modules after setting values () 2025-01-14 15:11:12 +00:00
Steven B.
d03f535568
Fix discover cli command with host () 2025-01-14 14:47:52 +00:00
Teemu R.
1be87674bf
Initial support for vacuums (clean module) ()
Adds support for clean module:
- Show current vacuum state
- Start cleaning (all rooms)
- Return to dock
- Pausing & unpausing
- Controlling the fan speed

---------

Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
2025-01-14 15:35:09 +01:00
Steven B.
be34dbd387
Make uses_http a readonly property of device config ()
`uses_http` will no longer be included in `DeviceConfig.to_dict()`
2025-01-14 14:20:53 +00:00
Steven B.
589d15091a
Add smartcam child device support for smartcam hubs () 2025-01-14 08:38:04 +00:00
Steven B.
a211cc0af5
Update hub children on first update and delay subsequent updates () 2025-01-13 17:19:40 +00:00
Teemu R.
6420d76351
ssltransport: use debug logger for sending requests () 2025-01-12 17:06:48 +01:00
Steven B.
660b9f81de
Add more redactors for smartcams ()
`alias` and `ext_addr` are new fields found on `smartcam` child devices
2025-01-10 18:34:11 +00:00
Steven B.
7b3dde9aa0
Raise errors on single smartcam child requests () 2025-01-06 16:11:43 +00:00
J. Nick Koston
7d508b5092
Backoff after xor timeout and improve error reporting () 2025-01-06 14:00:23 +00:00
Teemu R.
48a07a2970
Use repr() for enum values in Feature.__repr__ ()
Instead of simply displaying the enum value, use repr to get a nicer
output for the cli.
Was: `Error (vacuum_error): 14`
Now: `Error (vacuum_error): <ErrorCode.DustBinRemoved: 14>`
2025-01-06 13:23:02 +01:00
Steven B.
6aa019280b
Handle smartcam partial list responses () 2025-01-06 09:23:46 +00:00
Steven B.
6e0be2ea1f
Add support for Tapo hub-attached switch devices ()
Required for  and 
2025-01-04 14:20:06 +01:00
Teemu R.
e097b45984
Improve exception messages on credential mismatches () 2025-01-04 10:06:26 +00:00
Steven B.
0a95a41ab6
Update SslAesTransport for older firmware versions ()
Older firmware versions do not encrypt the payload.

Tested to work with C110 hw 2.0 fw 1.3.7 Build 230823 Rel.57279n(5553)

---------

Co-authored-by: Teemu R. <tpr@iki.fi>
2025-01-03 21:00:57 +01:00
Teemu R.
883d52209e
Fix incorrect obd src echo () 2025-01-03 18:07:46 +00:00
Steven B.
361697a239
Change smartcam detection features to category config () 2025-01-03 07:08:23 +00:00
Steven B.
8418ba3eef
Treat smartcam 500 errors after handshake as retryable ()
`smartcam` devices can respond with 500 if another session is created from the same host
2024-12-20 19:23:18 +00:00
Steven B.
93ca3ad2e1
Handle smartcam device blocked response ()
Devices that have failed authentication multiple times due to bad credentials go into a blocked state for 30 mins.
Handle that as a different error type instead of treating it as a normal `AuthenticationError`.
2024-12-20 14:55:15 +00:00
Steven B.
296af3192e
Handle KeyboardInterrupts in the cli better ()
Addresses an issue with how `asyncclick` deals with `KeyboardInterrupt`
errors. Instead of the `click.main` receiving `KeyboardInterrupt` it
receives `CancelledError` because it's a task running inside the loop.

Also ensures that discovery catches the `CancelledError` and closes the
http clients.
2024-12-20 14:21:38 +01:00
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.
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.
fe072657b4
Simplify get_protocol to prevent clashes with smartcam and robovac () 2024-12-17 07:39:17 +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.
e9109447a7
Add smartcam modules to package inits () 2024-12-16 13:20:26 +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
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