Improve categorization of features (#904)

This updates the categorization of features and makes the id mandatory for features
This commit is contained in:
Teemu R
2024-05-07 11:13:35 +02:00
committed by GitHub
parent 50b5107f75
commit 55653d0346
31 changed files with 131 additions and 52 deletions

View File

@@ -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: