Prevent the cli from allowing sub commands unless host or alias is specified.
It is unwise to allow commands to be run on an arbitrary set of discovered
devices so this PR shows an error if attempted.
Also consolidates other invalid cli operations to use a single error function
to display the error to the user.
Fixes issue with unpaired devices reporting light effect as `softAP`
reported in https://github.com/python-kasa/python-kasa/pull/972. I don't
think we need to handle that effect properly so just reports as off.
Adds an implementation of `_check_supported` to the light transition module so it is
not added to a parent device that reports it but doesn't support it, i.e. ks240.
Required for the P300 firmware update with `auto_off` module on child
devices. Will query child modules for parent devices that are not hubs.
Coverage will be fixed when the P300 fixture is added
https://github.com/python-kasa/python-kasa/pull/915
Replaces the logic to skip adding child modules to parent devices based
on whether a device is a wall switch and instead relies on the
`_check_supported` method. Is more future proof and will fix issue with
the P300 with child `auto_off` modules
https://github.com/python-kasa/python-kasa/pull/915 not supported on the
parent.
Executing wifi join requires passing the current time information for smart devices which we read from the device.
This PR removes wifi from the block list to make it work.
Picked this up while updating the [Fan platform
PR](https://github.com/home-assistant/core/pull/116605) for HA. The
smart fan module was not correctly deriving from the common interface
and the speed_level is reported as >0 when off.
Updates the RELEASING.md runbook with more steps and scripts.
Excludes dev release tags for prior releases.
Updates github_changelog_generator config to exclude pull requests
with the release-prep label from the changelog.
Co-authored-by: sdb9696
Fixes an issue reported by @bdraco with the P100 not working in the
latest branch:
`[Errno None] Can not write request body for HOST_REDACTED,
ClientOSError(None, 'Can not write request body for
URL_REDACTED'))`
Issue caused by the number of multi requests going above the default
batch of 5 and the P100 not being able to handle the second multi
request happening immediately as it closes the connection after each
query (See https://github.com/python-kasa/python-kasa/pull/690 for
similar issue). This introduces a small wait time on concurrent requests
once the device has raised a ClientOSError.
Adds some device fixtures by courtesy of @jimboca, thanks!
This is a slightly patched and rebased version of #441.
---------
Co-authored-by: JimBo <jimboca3@gmail.com>
Co-authored-by: sdb9696 <steven.beth@gmail.com>
Adds username and password arguments to discovery to remove the need to import Credentials.
Creates TypeAliases in Device for connection configuration classes and DeviceType.
Using the API with these changes will only require importing either Discover or Device
depending on whether using Discover.discover() or Device.connect() to
initialize and interact with the API.
Starts structuring the documentation library usage into Tutorials, Guides, Explanations and Reference.
Continues migrating new docs from rst to markdown.
Extends the test framework discovery mocks to allow easy writing and testing of code examples.
For power strips, the autooff data needs to be requested from the
children.
Until we do that, we should not create these features to avoid crashing
during switch platform initialization.
This also ports the module to use `_initialize_features` and add tests.
This is allows a generic implementation for the switch platform in the
homeassistant integration.
Also elevates set_state(bool) to be part of the standard API.
PR contains a number of fixes from testing with HA devices:
- Fixes a bug with turning the light on and off via `set_state`
- Aligns `set_brightness` behaviour across `smart` and `iot` devices
such that a value of 0 is off.
- Aligns `set_brightness` behaviour for `IotDimmer` such that setting
the brightness turns on the device with a transition of 1ms. ([HA
comment](https://github.com/home-assistant/core/pull/117839#discussion_r1608720006))
- Fixes a typing issue in `LightState`.
- Adds `ColorTempRange` and `HSV` to `__init__.py`
- Adds a `state` property to the interface returning `LightState` for
validating `set_state` changes.
- Adds tests for `set_state`
Adds light preset common module for switching to presets and saving presets.
Deprecates the `presets` attribute and `save_preset` method from the `bulb`
interface in favour of the modular approach. Allows setting preset for `iot`
which was not previously supported.
Fixes the test framework to handle fixtures with incomplete lists better by checking for completeness and overriding the sum. Also adds a pytest-timeout dev dependency with timeout set to 10 seconds. Finally fixes smartprotocol to prevent an infinite loop if incomplete lists ever happens in the real world.
Co-authored-by: Teemu R. <tpr@iki.fi>
Add a tutorial module with examples that can be tested with `doctest`.
In order to simplify the examples they can be run with doctest allowing
top level await statements by adding a fixture to patch the builtins
that xdoctest uses to test code.
---------
Co-authored-by: Teemu R. <tpr@iki.fi>
Deprecates the attributes at device level for light, light effects, and led. i.e. device.led, device.is_color. Will continue to support consumers using these attributes and emit a warning.
Implements the `light_strip_lighting_effect` components for
`smart` devices. Uses a new list of effects captured from a L900 which
are similar to the `iot` effects but include some additional properties
and a few extra effects.
Assumes that a device only implements `light_strip_lighting_effect` or
`light_effect` but not both.
Address the inconsistent naming of smart modules by removing all "Module" suffixes and aligning filenames with class names. Removes the casting of modules to the correct module type now that is is redundant. Update the adding of iot modules to use the ModuleName class rather than a free string.