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>
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
Addresses stability issues on older hw device versions
- Handles module timeout errors better by querying modules individually on errors and disabling problematic modules like Firmware that go out to the internet to get updates.
- Addresses an issue with the Led module on P100 hardware version 1.0 which appears to have a memory leak and will cause the device to crash after approximately 500 calls.
- Delays updates of modules that do not have regular changes like LightPreset and LightEffect and enables them to be updated on the next update cycle only if required values have changed.