mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Improve categorization of features (#904)
This updates the categorization of features and makes the id mandatory for features
This commit is contained in:
@@ -62,6 +62,8 @@ class Feature:
|
||||
|
||||
#: Device instance required for getting and setting values
|
||||
device: Device
|
||||
#: Identifier
|
||||
id: str
|
||||
#: User-friendly short description
|
||||
name: str
|
||||
#: Name of the property that allows accessing the value
|
||||
@@ -99,15 +101,8 @@ class Feature:
|
||||
#: If set, this property will be used to set *choices*.
|
||||
choices_getter: str | None = None
|
||||
|
||||
#: Identifier
|
||||
id: str | None = None
|
||||
|
||||
def __post_init__(self):
|
||||
"""Handle late-binding of members."""
|
||||
# Set id, if unset
|
||||
if self.id is None:
|
||||
self.id = self.name.lower().replace(" ", "_")
|
||||
|
||||
# Populate minimum & maximum values, if range_getter is given
|
||||
container = self.container if self.container is not None else self.device
|
||||
if self.range_getter is not None:
|
||||
|
Reference in New Issue
Block a user