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.
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>
This is in preparation for tests based on supporting features amongst
other tweaks:
- Consolidates the filtering logic that was split across `filter_model`
and `filter_fixture`
- Allows filtering `dev` fixture by `component`
- Consolidates fixtures missing method warnings into one warning
- Does not raise exceptions from `FakeSmartTransport` for missing
methods (required for KS240)
Adds initial support for H100 and its alarmmodule.
Also implements the following modules for T315:
* reportmodule (reporting interval)
* battery
* humidity
* temperature
With the move towards autodetecting available features, there is no reason to keep SmartPlug around.
kasa.smart.SmartPlug is removed in favor of kasa.smart.SmartDevice which offers the same functionality.
Information about auto_off can be accessed using Features of the AutoOffModule on supported devices.
Co-authored-by: Steven B. <51370195+sdb9696@users.noreply.github.com>
* Fix discovery cli to print devices not printed during discovery
* Fix tests
* Fix print exceptions not being propagated
* Fix tests
* Reduce test discover_send time
* Simplify wait logic
* Add tests
* Remove sleep loop and make auth failed a list
* Separate fake protocols for iot and smart
* Move control_child impl into its own method
* Organize schemas into correct places
* Add test_childdevice
* Add missing return for _handle_control_child
- Show discovery results for unsupported devices and devices that fail to authenticate.
- Rename `--show-unsupported` to `--verbose`.
- Remove separate `--timeout` parameter from cli discovery so it's not confused with `--timeout` now added to cli command.
- Add tests.
* Add KP125M fixture. Enable tapo auth in pytest.
* authentication is not just for tapo
* Use "##MASKEDNAME##" base64 for nickname and ssid.
---------
Co-authored-by: Teemu R. <tpr@iki.fi>
* Add support for tapo light bulbs
* Use TapoDevice for on/off
* Add tapobulbs to discovery
* Add partial support for effects
Activating the effect does not work as I thought it would,
but this implements rest of the interface from SmartLightStrip.
* Add missing __init__ for tapo package
* Make mypy happy
* Add docstrings to make ruff happy
* Implement state_information and has_emeter
* Import tapoplug from kasa.tapo package
* Add tapo L530 fixture
* Enable tests for L530 fixture
* Make ruff happy
* Update fixture filename
* Raise exceptions on invalid parameters
* Return results in a wrapped dict
* Implement set_*
* Reorganize bulbs to iot&smart, fix tests for smarts
* Fix linting
* Fix BULBS_LIGHT_STRIP back to LIGHT_STRIPS
* Add support for TAPO/SMART KLAP and seperate transports from protocols
* Add tests and some review changes
* Update following review
* Updates following review
* Add KP125 test fixture and support note.
Signed-off-by: James Alseth <james@jalseth.me>
* mark KP125 having an emeter
Co-authored-by: Teemu R <tpr@iki.fi>