100 Commits

Author SHA1 Message Date
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.
0f185f1905
Add commit-hook to prettify JSON files () 2025-01-15 16:06:52 +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
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.
57f6c4138a
Add D230(EU) 1.20 1.1.19 fixture () 2025-01-14 08:46:29 +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
Steven B.
2e3b1bc376
Add tests for dump_devinfo parent/child smartcam fixture generation ()
Currently the dump_devinfo fixture generation tests do not test
generation for hub and their children.

This PR enables tests for `smartcam` hubs and their child fixtures. It
does not enable support for `smart` hub fixtures as not all the fixtures
currently have the required info. This can be addressed in a subsequent
PR.
2025-01-08 22:51:35 +01:00
steveredden
debcff9f9b
Add fixture for C720 camera () 2025-01-08 22:22:26 +01:00
ZeliardM
3c038fc13b
Add KS230(US) 2.0 1.0.11 IOT Fixture () 2025-01-07 15:40:37 +00:00
J. Nick Koston
7d508b5092
Backoff after xor timeout and improve error reporting () 2025-01-06 14:00:23 +00:00
Steven B.
6aa019280b
Handle smartcam partial list responses () 2025-01-06 09:23:46 +00:00
Teemu R.
1f45f425a0
Add S210 fixture () 2025-01-04 19:09:58 +00:00
Teemu R.
08639a3a7b
Add S220 fixture ()
Add S220 (hub-connected) fixture, thanks to @chrisnewmanuk.

Drafted as requires adding `subg.plugswitch.switch` as a supported child
device category.

ref
https://github.com/home-assistant/core/issues/133973#issuecomment-2569967648
2025-01-04 19:47:12 +01: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
Steven B.
5d49623d5d
Add C210 2.0 1.3.11 fixture () 2025-01-03 06:55:55 +00:00
ZeliardM
d0aba68e7a
Add HS210(US) 3.0 1.0.10 IOT Fixture () 2024-12-24 15:56:14 +00:00
Bipolar Chemist
9b1be1c0b2
Add P306(US) 1.0 1.1.2 fixture () 2024-12-21 09:36:57 +00:00
Steven B.
d81cf1b3b6
Add P210M(US) 1.0 1.0.3 fixture () 2024-12-21 09:20:12 +00:00
Steven B.
cef0e571a0
Add C225(US) 2.0 1.0.11 fixture () 2024-12-21 09:17:50 +00:00
Steven B.
522c78350e
Add P135 1.0 1.2.0 fixture () 2024-12-21 09:17:00 +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
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.
d890b0a3ac
Add smartcam detection modules ()
- Motion detection
- Person detection
- Tamper detection
- Baby Cry Detection
2024-12-20 00:22:08 +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.
d03a387a74
Add new methods to dump_devinfo ()
Adds `getMatterSetupInfo`, `getConnectStatus` and `scanApList`
2024-12-16 13:06:26 +00: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.
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
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.
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