mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Embed FeatureType inside Feature (#860)
Moves `FeatureType` into `Feature` to make it easier to use the API. This also enforces that no invalid types are accepted (i.e., `Category.Config` cannot be a `Sensor`) If `--verbose` is used with the cli tool, some extra information is displayed for features when in the state command.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Implementation of the ambient light (LAS) module found in some dimmers."""
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ..iotmodule import IotModule, merge
|
||||
|
||||
# TODO create tests and use the config reply there
|
||||
@@ -25,7 +25,7 @@ class AmbientLight(IotModule):
|
||||
name="Ambient Light",
|
||||
icon="mdi:brightness-percent",
|
||||
attribute_getter="ambientlight_brightness",
|
||||
type=FeatureType.Sensor,
|
||||
type=Feature.Type.Sensor,
|
||||
)
|
||||
)
|
||||
|
||||
|
@@ -5,7 +5,7 @@ try:
|
||||
except ImportError:
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ..iotmodule import IotModule
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class Cloud(IotModule):
|
||||
name="Cloud connection",
|
||||
icon="mdi:cloud",
|
||||
attribute_getter="is_connected",
|
||||
type=FeatureType.BinarySensor,
|
||||
type=Feature.Type.BinarySensor,
|
||||
)
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user