diff --git a/kasa/cli.py b/kasa/cli.py index 5068ab46..037abae0 100755 --- a/kasa/cli.py +++ b/kasa/cli.py @@ -1110,10 +1110,10 @@ async def shell(dev: Device): @click.argument("value", required=False) @pass_dev async def feature(dev, name: str, value): - """Access and modify descriptor values. + """Access and modify features. - If no *name* is given, lists available descriptors and their values. - If only *name* is given, the value of named descriptor is returned. + If no *name* is given, lists available features and their values. + If only *name* is given, the value of named feature is returned. If both *name* and *value* are set, the described setting is changed. """ if not name: @@ -1123,7 +1123,7 @@ async def feature(dev, name: str, value): return if name not in dev.features: - echo(f"No descriptor by name {name}") + echo(f"No feature by name {name}") return feat = dev.features[name] diff --git a/kasa/feature.py b/kasa/feature.py index 14e9a643..11444e8d 100644 --- a/kasa/feature.py +++ b/kasa/feature.py @@ -8,7 +8,7 @@ if TYPE_CHECKING: class FeatureCategory(Enum): - """Descriptor category.""" + """Feature category.""" # TODO: we could probably do better than using the scheme homeassistant is using Config = auto() @@ -40,8 +40,6 @@ class Feature: container: Any = None #: Icon suggestion icon: str | None = None - #: Unit of the descriptor - unit: str | None = None #: Hint for homeassistant #: TODO: Replace with a set of flags to allow homeassistant make its own decision? show_in_hass: bool = True diff --git a/kasa/iot/iotdevice.py b/kasa/iot/iotdevice.py index 67337ad4..3d7b3ac1 100755 --- a/kasa/iot/iotdevice.py +++ b/kasa/iot/iotdevice.py @@ -302,12 +302,12 @@ class IotDevice(Device): self._set_sys_info(response["system"]["get_sysinfo"]) if not self._features: - await self._initialize_descriptors() + await self._initialize_features() await self._modular_update(req) self._set_sys_info(self._last_update["system"]["get_sysinfo"]) - async def _initialize_descriptors(self): + async def _initialize_features(self): self.add_feature( Feature( device=self, name="RSSI", attribute_getter="rssi", icon="mdi:signal" diff --git a/kasa/iot/modules/module.py b/kasa/iot/modules/module.py index 07a4f0dd..73808241 100644 --- a/kasa/iot/modules/module.py +++ b/kasa/iot/modules/module.py @@ -38,7 +38,7 @@ class IotModule(ABC): self._module_features: Dict[str, Feature] = {} def add_feature(self, feature: Feature): - """Add module descriptor.""" + """Add module feature.""" feature_name = f"{self._module}_{feature.name}" if feature_name in self._module_features: raise SmartDeviceException("Duplicate name detected %s" % feature_name) diff --git a/kasa/smart/smartdevice.py b/kasa/smart/smartdevice.py index 49a3a2ea..9bb75350 100644 --- a/kasa/smart/smartdevice.py +++ b/kasa/smart/smartdevice.py @@ -119,10 +119,10 @@ class SmartDevice(Device): for info in child_info["child_device_list"]: self._children[info["device_id"]].update_internal_state(info) - # We can first initialize the descriptors after the first update. - # We make here an assumption that every device has at least a single descriptor. + # We can first initialize the features after the first update. + # We make here an assumption that every device has at least a single feature. if not self._features: - await self._initialize_descriptors() + await self._initialize_features() _LOGGER.debug("Got an update: %s", self._last_update) @@ -131,8 +131,8 @@ class SmartDevice(Device): if "energy_monitoring" in self._components: self.emeter_type = "emeter" - async def _initialize_descriptors(self): - """Initialize device descriptors.""" + async def _initialize_features(self): + """Initialize device features.""" self.add_feature( Feature( self,