mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-22 06:31:30 +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:
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...exceptions import KasaException
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ..smartmodule import SmartModule
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -35,7 +35,7 @@ class LightTransitionModule(SmartModule):
|
||||
icon=icon,
|
||||
attribute_getter="enabled_v1",
|
||||
attribute_setter="set_enabled_v1",
|
||||
type=FeatureType.Switch,
|
||||
type=Feature.Type.Switch,
|
||||
)
|
||||
)
|
||||
elif self.supported_version >= 2:
|
||||
@@ -51,7 +51,7 @@ class LightTransitionModule(SmartModule):
|
||||
attribute_getter="turn_on_transition",
|
||||
attribute_setter="set_turn_on_transition",
|
||||
icon=icon,
|
||||
type=FeatureType.Number,
|
||||
type=Feature.Type.Number,
|
||||
maximum_value=self.MAXIMUM_DURATION,
|
||||
)
|
||||
) # self._turn_on_transition_max
|
||||
@@ -63,7 +63,7 @@ class LightTransitionModule(SmartModule):
|
||||
attribute_getter="turn_off_transition",
|
||||
attribute_setter="set_turn_off_transition",
|
||||
icon=icon,
|
||||
type=FeatureType.Number,
|
||||
type=Feature.Type.Number,
|
||||
maximum_value=self.MAXIMUM_DURATION,
|
||||
)
|
||||
) # self._turn_off_transition_max
|
||||
|
||||
Reference in New Issue
Block a user