mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-12 02:18:02 +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, Any, Optional
|
||||
|
||||
from ...exceptions import SmartErrorCode
|
||||
from ...feature import Feature, FeatureType
|
||||
from ...feature import Feature
|
||||
from ..smartmodule import SmartModule
|
||||
|
||||
try:
|
||||
@@ -59,7 +59,7 @@ class Firmware(SmartModule):
|
||||
container=self,
|
||||
attribute_getter="auto_update_enabled",
|
||||
attribute_setter="set_auto_update_enabled",
|
||||
type=FeatureType.Switch,
|
||||
type=Feature.Type.Switch,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
@@ -68,7 +68,7 @@ class Firmware(SmartModule):
|
||||
"Update available",
|
||||
container=self,
|
||||
attribute_getter="update_available",
|
||||
type=FeatureType.BinarySensor,
|
||||
type=Feature.Type.BinarySensor,
|
||||
)
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user