mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Add generic interface for accessing device features (#741)
This adds a generic interface for all device classes to introspect available device features, that is necessary to make it easier to support a wide variety of supported devices with different set of features. This will allow constructing generic interfaces (e.g., in homeassistant) that fetch and change these features without hard-coding the API calls. `Device.features()` now returns a mapping of `<identifier, Feature>` where the `Feature` contains all necessary information (like the name, the icon, a way to get and change the setting) to present and change the defined feature through its interface.
This commit is contained in:
@@ -33,6 +33,7 @@ from kasa.exceptions import (
|
||||
TimeoutException,
|
||||
UnsupportedDeviceException,
|
||||
)
|
||||
from kasa.feature import Feature, FeatureType
|
||||
from kasa.iot.iotbulb import BulbPreset, TurnOnBehavior, TurnOnBehaviors
|
||||
from kasa.iotprotocol import (
|
||||
IotProtocol,
|
||||
@@ -54,6 +55,8 @@ __all__ = [
|
||||
"TurnOnBehaviors",
|
||||
"TurnOnBehavior",
|
||||
"DeviceType",
|
||||
"Feature",
|
||||
"FeatureType",
|
||||
"EmeterStatus",
|
||||
"Device",
|
||||
"Bulb",
|
||||
|
Reference in New Issue
Block a user