mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-21 20:20:11 +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:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ..smartmodule import SmartModule
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -27,7 +27,7 @@ class FanModule(SmartModule):
|
||||
attribute_getter="fan_speed_level",
|
||||
attribute_setter="set_fan_speed_level",
|
||||
icon="mdi:fan",
|
||||
type=FeatureType.Number,
|
||||
type=Feature.Type.Number,
|
||||
minimum_value=1,
|
||||
maximum_value=4,
|
||||
category=Feature.Category.Primary,
|
||||
@@ -41,7 +41,7 @@ class FanModule(SmartModule):
|
||||
attribute_getter="sleep_mode",
|
||||
attribute_setter="set_sleep_mode",
|
||||
icon="mdi:sleep",
|
||||
type=FeatureType.Switch,
|
||||
type=Feature.Type.Switch,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user