Commit Graph

150 Commits

Author SHA1 Message Date
Teemu Rytilahti
a081a46caa Cleanup a bit 2024-12-02 13:19:32 +01:00
Teemu Rytilahti
7332c1d262 Await calls 2024-12-02 13:19:32 +01:00
Teemu Rytilahti
bf27844534 Initial support for vacuums (clean module) 2024-12-02 13:19:32 +01:00
Teemu R.
9966c6094a
Add ssltransport for robovacs (#943)
This PR implements a clear-text, token-based transport protocol seen on
RV30 Plus (#937).

- 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.
0c755f7120
Include duration when disabling smooth transition on/off (#1313)
Fixes #1309
2024-11-26 10:39:31 +00:00
Teemu R.
69e08c2385
Expose energy command to cli (#1307)
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 (#977) 2024-11-26 09:37:15 +00:00
Steven B.
cb4e28394d
Update docs for the new module attributes has/get feature (#1301) 2024-11-26 08:38:20 +00:00
Steven B.
37cc4da7b6
Allow getting Annotated features from modules (#1018)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-11-22 07:52:23 +00:00
Steven B.
cae9decb02
Exclude __getattr__ for deprecated attributes from type checkers (#1294) 2024-11-21 18:40:13 +00:00
Ryan Nitcher
dab64e5d48
Add voltage and current monitoring to smart Devices (#1281) 2024-11-20 18:18:30 +00:00
Steven B.
df48c21900
Migrate triggerlogs to mashumaru (#1277) 2024-11-20 13:21:08 +00:00
Steven B.
999e84d2de
Migrate smart firmware module to mashumaro (#1276) 2024-11-20 11:54:13 +00: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.
9d46996e9b
Fix repr for device created with no sysinfo or discovery info" (#1266)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-11-18 13:14:39 +00:00
Steven B.
e55731c110
Move protocol modules into protocols package (#1254) 2024-11-13 17:50:21 +00:00
Teemu R.
668ba748c5
Move transports into their own package (#1247)
This moves all transport implementations into a new `transports` package
for cleaner main package & easier to understand project structure.
2024-11-12 14:40:44 +01:00
Steven B.
71ae06fa83
Fix test framework running against real devices (#1235) 2024-11-11 17:41:31 +00:00
Teemu R.
66eb17057e
Enable ruff check for ANN (#1139) 2024-11-10 18:55:13 +00:00
Teemu R.
4026e8a80c
Make __repr__ work on discovery info (#1233)
This PR will make `__repr__` also work on smartdevices where only
discovery data is available by modifying the `model` property to
fallback to the data found in the discovery payloads.
2024-11-07 20:09:51 +01:00
Teemu R.
0360107e3f
Add childprotection module (#1141)
When turned on, rotating the thermostat will not change the target
temperature.
2024-11-01 20:46:36 +01:00
Teemu R.
70c96b5a5d
Initial trigger logs implementation (#900)
Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
2024-11-01 15:36:09 +00:00
Steven B.
e73da5b677
Fix AES child device creation error (#1220)
Bug exposed when passing credentials_hash and creating child devices for
klap devices as the default is to try to create an AES transport and the
credentials hashes are incompatible.
2024-10-31 15:21:54 +00:00
Steven B.
673a32258f
Make HSV NamedTuple creation more efficient (#1211) 2024-10-29 17:14:52 +00:00
Fulch36
8b95b7d557
Fallback to get_current_power if get_energy_usage does not provide current_power (#1186) 2024-10-25 19:24:43 +01:00
Steven B.
28361c1727
Add core device, child and camera modules to smartcamera (#1193)
Co-authored-by: Teemu R. <tpr@iki.fi>
2024-10-24 17:22:45 +01:00
Steven B.
51958d8078
Allow deriving from SmartModule without being registered (#1189) 2024-10-23 21:42:01 +01:00
Steven B.
cd0a74ca96
Improve supported module checks for hub children (#1188)
No devices in `fixtures/smart/child` support the `get_device_time` or
`get_device_usage` methods so this PR tests for whether the device is a
hub child and marks those modules/methods as not supported. This
prevents features being erroneously created on child devices.

It also moves the logic for getting the time from the parent module
behind getting it from the child module which was masking the creation
of these unsupported modules.
2024-10-23 17:17:27 +02:00
Teemu R.
8a17752ae2
Add waterleak alert timestamp (#1162)
The T300 reports the timestamp of the last alarm, this exposes it to
consumers.
2024-10-18 13:18:12 +02:00
Teemu R.
486984fff8
Add motion sensor to known categories (#1176)
Also, improve device type warning on unknown devices
2024-10-18 12:31:52 +02:00
Steven B.
c6f2d89d44
Expose smart child device map as a class constant (#1173)
To facilitate distinguishing between smart and smart camera child devices.
2024-10-18 09:55:07 +01:00
Steven B.
7fd8c14c1f
Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
Steven B.
7c1686d3ae
Cache zoneinfo for smart devices (#1156) 2024-10-08 12:21:01 +01:00
Steven B.
9641edcbc0
Make iot time timezone aware (#1147)
Also makes on_since for iot devices use device time.
Changes the return value for device.timezone to be tzinfo instead of a dict.
2024-10-08 08:16:51 +01:00
Steven B.
1026e890a1
Correctly define SmartModule.call as an async function (#1148) 2024-10-02 16:00:27 +01:00
Steven B.
1fcf3e44c2
Stabilise on_since value for smart devices (#1144)
Caches the `on_since` value to prevent jitter caused by the device calculations.
2024-10-02 15:04:16 +01:00
Teemu R.
d897503b58
Move feature initialization from __init__ to _initialize_features (#1140) 2024-09-28 20:14:31 +02:00
Teemu R.
2a89e58ae0
Add missing type hints to alarm module (#1111) 2024-09-10 17:20:00 +01:00
Steven B.
520b9d7a38
Disable automatic updating of latest firmware (#1103)
To resolve issues with the calls to the tplink cloud to get the latest firmware.
Disables the automatic calling of `get_latest_fw` and requires firmware update checks to be triggered manually.
2024-08-30 18:01:54 +01:00
Teemu R.
6a86ffbbba
Add flake8-pytest-style (PT) for ruff (#1105)
This will catch common issues with pytest code.

* Use `match` when using `pytest.raises()` for base exception types like
`TypeError` or `ValueError`
* Use tuples for `parametrize()`
* Enforces `pytest.raises()` to contain simple statements, using `noqa`
to skip this on some cases for now.
* Fixes incorrect exception type (valueerror instead of typeerror) for
iotdimmer.
* Adds check valid types for `iotbulb.set_hsv` and `color` smart module.
* Consolidate exception messages for common interface modules.
2024-08-30 17:30:07 +02:00
Teemu R.
3e43781bb2
Add flake8-logging (LOG) and flake8-logging-format (G) for ruff (#1104)
Enables rules LOG (flake8-logging) and G (flake8-logging-format) for
ruff. This will catch eager log message formatting, among other similar
issues.
2024-08-30 16:13:14 +02:00
Steven B.
31ec27c1c8
Fix iot light effect brightness (#1092)
Fixes issue where the brightness of the `iot` light effect is set properly
on the light effect but read back incorrectly from the light.
2024-07-31 15:58:48 +01:00
Steven B.
cb7e904d30
Enable setting brightness with color temp for smart devices (#1091) 2024-07-31 15:52:27 +01:00
Steven B.
7bba9926ed
Allow erroring modules to recover (#1080)
Re-query failed modules after some delay instead of immediately disabling them.
Changes to features so they can still be created when modules are erroring.
2024-07-30 19:23:07 +01:00
Teemu R.
055bbcc0c9
Add support for T100 motion sensor (#1079)
Add support for T100 motion sensor.
Thanks to @DarthSonic for the fixture file!
2024-07-24 15:48:33 +02:00
Teemu R.
dc0aedad20
Expose reboot action (#1073)
Expose reboot through the feature interface.
This can be useful in situations where one wants to reboot the device,
e.g., in recent cases where frequent update calls will render the device
unresponsive after a specific amount of time.
2024-07-24 15:47:38 +02:00
Steven B.
58afeb28a1
Update smart request parameter handling (#1061)
Changes to the smart request handling:
- Do not send params if null
- Drop the requestId parameter
- get_preset_rules doesn't send parameters for preset component version less than 3
- get_led_info no longer sends the wrong parameters
- get_on_off_gradually_info no longer sends an empty {} parameter
2024-07-23 19:02:20 +01:00
Steven B.
c4f015a2fb
Redact sensitive info from debug logs (#1069)
Redacts sensitive data when debug logging device responses such as mac,
location and usernames
2024-07-17 19:57:09 +02:00
Steven B.
e17ca21a83
Only refresh smart LightEffect module daily (#1064)
Fixes an issue with L530 bulbs on HW version 1.0 whereby the light effect
query causes the device to crash with JSON_ENCODE_FAIL_ERROR after
approximately 60 calls.
2024-07-17 08:28:11 +01:00