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
Currently if the library encounters an invalid decryption error it
raises a value error. This PR wraps it in a KasaException so consumers
such as HA can catch an expected library exception.
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.
- Fixes issue running pyshark on new thread in windows
- Fixes bug if handshake repeated during capture
- Tries the default tplink hardcoded credentials as per the library
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.
Pick commit a044063526 from #1054
Instead of trying to use the first state when multiple are reported,
iterate over the known states and pick the first matching.
This will fix an issue where the device reports extra states (like
`low_battery`) while having a known mode active.
Related to home-assistant/core#121335
Pick commit 7fd5c213e6 from 1052
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.
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.
Instead of trying to use the first state when multiple are reported,
iterate over the known states and pick the first matching.
This will fix an issue where the device reports extra states (like
`low_battery`) while having a known mode active.
Related to https://github.com/home-assistant/core/issues/121335
PR with just the initial structural changes for the cli to be a package.
Subsequent PR will break out `main.py` into modules. Doing it in two
stages ensure that the commit history will be continuous for `cli.py` >
`cli/main.py`
Ensures that all modules try to access their data in `_post_update_hook` in a safe manner and disable themselves if there's an error.
Also adds parameters to get_preset_rules and get_on_off_gradually_info to fix issues with recent firmware updates.
Cherry pick of [#1036](https://github.com/python-kasa/python-kasa/pull/1036) to patch
Ensures that all modules try to access their data in `_post_update_hook` in a safe manner and disable themselves if there's an error.
Also adds parameters to get_preset_rules and get_on_off_gradually_info to fix issues with recent firmware updates.
[#1033](https://github.com/python-kasa/python-kasa/issues/1033)
Adds a new decorator that adds child options to a command and gets the
child device if the options are set.
- Single definition of options and error handling
- Adds options automatically to command
- Backwards compatible with `--index` and `--name`
- `--child` allows for id and alias for ease of use
- Omitting a value for `--child` gives an interactive prompt
Implements private `_update` to allow the CLI to patch a child `update`
method to call the parent device `update`.
Example help output:
```
$ kasa brightness --help
Usage: kasa brightness [OPTIONS] [BRIGHTNESS]
Get or set brightness.
Options:
--transition INTEGER
--child, --name TEXT Child ID or alias for controlling sub-
devices. If no value provided will show an
interactive prompt allowing you to select a
child.
--child-index, --index INTEGER Child index controlling sub-devices
--help Show this message and exit.
```
Fixes#769
If discovery is triggered without credentials and discovers devices requiring authentication,
blank credentials are used to initialise the protocols and no connection is actually made.
In this instance we should not return the credentials_hash for blank credentials as it will be invalid.
Move the static command line options into the config file for
consistency and remove `--no-issues` in favour of
`issues-wo-labels=false` to fix the problem where `release-summary`
issues are being excluded from the changelog.
This PR changes the behavior of `brightness` module if an effect is
active.
Currently, changing the brightness disables the effect when the
brightness is changed, this fixes that.
This will also improve the `set_effect` interface to use the current
brightness when an effect is activated.
* light_strip_effect: passing `bAdjusted` with the changed properties
changes the brightness.
* light_effect: the brightness is stored only in the rule, so we modify
it when adjusting the brightness. This is also done during the initial
effect activation.
---------
Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com>
Fixes module to work with child devices, i.e. ks240
Interrogates the data to see whether maximums are available.
Fixes a bug whereby setting a duration while the feature is not
enabled does not actually enable it.
Makes unknown error codes to be reported through KasaException which may
be recoverable in some cases (i.e., a single command failing in the
multi request).
Related to https://github.com/home-assistant/core/issues/118446