Implement feature categories (#846)

Initial implementation for feature categories to help downstreams and
our cli tool to categorize the data for more user-friendly manner. As
more and more information is being exposed through the generic features
interface, it is necessary to give some hints to downstreams about how
might want to present the information to users.

This is not a 1:1 mapping to the homeassistant's mental model, and it
will be necessary to fine-tune homeassistant-specific parameters by
other means to polish the presentation.
This commit is contained in:
Teemu R
2024-04-23 19:20:12 +02:00
committed by GitHub
parent aa969ef020
commit b860c32d5f
12 changed files with 123 additions and 21 deletions

View File

@@ -221,6 +221,7 @@ class IotBulb(IotDevice, Bulb):
minimum_value=1,
maximum_value=100,
type=FeatureType.Number,
category=Feature.Category.Primary,
)
)
@@ -233,6 +234,7 @@ class IotBulb(IotDevice, Bulb):
attribute_getter="color_temp",
attribute_setter="set_color_temp",
range_getter="valid_temperature_range",
category=Feature.Category.Primary,
)
)

View File

@@ -306,7 +306,11 @@ class IotDevice(Device):
async def _initialize_features(self):
self._add_feature(
Feature(
device=self, name="RSSI", attribute_getter="rssi", icon="mdi:signal"
device=self,
name="RSSI",
attribute_getter="rssi",
icon="mdi:signal",
category=Feature.Category.Debug,
)
)
if "on_time" in self._sys_info: