Commit Graph

13 Commits

Author SHA1 Message Date
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
Steven B
33d839866e
Make Light and Fan a common module interface (#911) 2024-05-13 17:34:44 +01:00
Steven B
9473d97ad2
Create common interfaces for remaining device types (#895)
Introduce common module interfaces across smart and iot devices and provide better typing implementation for getting modules to support this.
2024-05-10 19:29:28 +01:00
Steven B
e410e4f3f3
Fix incorrect state updates in FakeTestProtocols (#861) 2024-04-24 12:25:16 +01:00
Teemu R
35dbda7049
Change state_information to return feature values (#804)
This changes `state_information` to return the names and values of
all defined features.
It was originally a "temporary" hack to show some extra, device-specific
information in the cli tool, but now that we have device-defined
features we can leverage them.
2024-03-26 19:28:39 +01:00
Teemu R
48ac39e6d8
Refactor split smartdevice tests to test_{iot,smart}device (#822) 2024-03-15 15:55:48 +00:00
Steven B
8c39e81a40
Rename and deprecate exception classes (#739)
# Public #
SmartDeviceException -> KasaException
UnsupportedDeviceException(SmartDeviceException) -> UnsupportedDeviceError(KasaException)
TimeoutException(SmartDeviceException, asyncio.TimeoutError) -> TimeoutError(KasaException, asyncio.TimeoutError)

Add new exception for error codes -> DeviceError(KasaException)
AuthenticationException(SmartDeviceException) -> AuthenticationError(DeviceError)

# Internal #
RetryableException(SmartDeviceException) -> _RetryableError(DeviceError)
ConnectionException(SmartDeviceException) -> _ConnectionError(KasaException)
2024-02-21 16:52:55 +01:00
Steven B
0d119e63d0
Refactor devices into subpackages and deprecate old names (#716)
* Refactor devices into subpackages and deprecate old names

* Tweak and add tests

* Fix linting

* Remove duplicate implementations affecting project coverage

* Update post review

* Add device base class attributes and rename subclasses

* Rename Module to BaseModule

* Remove has_emeter_history

* Fix missing _time in init

* Update post review

* Fix test_readmeexamples

* Fix erroneously duped files

* Clean up iot and smart imports

* Update post latest review

* Tweak Device docstring
2024-02-04 16:20:08 +01:00
Teemu R
12c98eb58d
Add transition parameter to lightstrip's set_effect (#416) 2023-02-18 18:03:54 +01:00
Teemu R
6e7a588d40
Add brightness to lightstrip's set_effect (#415)
* Add brightness parameter to lightstrip's set_effect

* Use None as default as effects have different default brightnesses
2023-01-21 00:25:59 +01:00
Julian Davis
866c8d6db5
Fix pytest warnings about asyncio (#397)
Turn on ayncio auto mode for pytest and remove the global async marking flag
2022-11-13 23:34:47 +01:00
J. Nick Koston
58f6517445
Add effect support for light strips (#293)
* Add effect support for KL430

* KL400 supports effects

* Add KL400 fixture

* Comments from review

* actually commit the remove
2022-03-21 22:10:12 +01:00
Teemu R
f1b28e79b9
Add KL130 fixture, initial lightstrip tests (#214) 2021-09-24 22:26:21 +02:00