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:
@@ -213,6 +213,7 @@ class IotBulb(IotDevice, Bulb):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="brightness",
|
||||
name="Brightness",
|
||||
attribute_getter="brightness",
|
||||
attribute_setter="set_brightness",
|
||||
@@ -227,6 +228,7 @@ class IotBulb(IotDevice, Bulb):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="color_temperature",
|
||||
name="Color temperature",
|
||||
container=self,
|
||||
attribute_getter="color_temp",
|
||||
|
@@ -334,6 +334,7 @@ class IotDevice(Device):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="rssi",
|
||||
name="RSSI",
|
||||
attribute_getter="rssi",
|
||||
icon="mdi:signal",
|
||||
@@ -344,6 +345,7 @@ class IotDevice(Device):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="on_since",
|
||||
name="On since",
|
||||
attribute_getter="on_since",
|
||||
icon="mdi:clock",
|
||||
|
@@ -91,12 +91,15 @@ class IotDimmer(IotPlug):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="brightness",
|
||||
name="Brightness",
|
||||
attribute_getter="brightness",
|
||||
attribute_setter="set_brightness",
|
||||
minimum_value=1,
|
||||
maximum_value=100,
|
||||
unit="%",
|
||||
type=Feature.Type.Number,
|
||||
category=Feature.Category.Primary,
|
||||
)
|
||||
)
|
||||
|
||||
|
@@ -65,6 +65,7 @@ class IotPlug(IotDevice):
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device=self,
|
||||
id="led",
|
||||
name="LED",
|
||||
icon="mdi:led-{state}",
|
||||
attribute_getter="led",
|
||||
|
@@ -22,10 +22,13 @@ class AmbientLight(IotModule):
|
||||
Feature(
|
||||
device=device,
|
||||
container=self,
|
||||
id="ambient_light",
|
||||
name="Ambient Light",
|
||||
icon="mdi:brightness-percent",
|
||||
attribute_getter="ambientlight_brightness",
|
||||
type=Feature.Type.Sensor,
|
||||
category=Feature.Category.Primary,
|
||||
unit="%",
|
||||
)
|
||||
)
|
||||
|
||||
|
@@ -30,10 +30,12 @@ class Cloud(IotModule):
|
||||
Feature(
|
||||
device=device,
|
||||
container=self,
|
||||
id="cloud_connection",
|
||||
name="Cloud connection",
|
||||
icon="mdi:cloud",
|
||||
attribute_getter="is_connected",
|
||||
type=Feature.Type.BinarySensor,
|
||||
category=Feature.Category.Info,
|
||||
)
|
||||
)
|
||||
|
||||
|
@@ -24,6 +24,7 @@ class Emeter(Usage):
|
||||
unit="W",
|
||||
id="current_power_w", # for homeassistant backwards compat
|
||||
precision_hint=1,
|
||||
category=Feature.Category.Primary,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
@@ -35,16 +36,19 @@ class Emeter(Usage):
|
||||
unit="kWh",
|
||||
id="today_energy_kwh", # for homeassistant backwards compat
|
||||
precision_hint=3,
|
||||
category=Feature.Category.Info,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device,
|
||||
id="consumption_this_month",
|
||||
name="This month's consumption",
|
||||
attribute_getter="emeter_this_month",
|
||||
container=self,
|
||||
unit="kWh",
|
||||
precision_hint=3,
|
||||
category=Feature.Category.Info,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
@@ -56,6 +60,7 @@ class Emeter(Usage):
|
||||
unit="kWh",
|
||||
id="total_energy_kwh", # for homeassistant backwards compat
|
||||
precision_hint=3,
|
||||
category=Feature.Category.Info,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
@@ -67,6 +72,7 @@ class Emeter(Usage):
|
||||
unit="V",
|
||||
id="voltage", # for homeassistant backwards compat
|
||||
precision_hint=1,
|
||||
category=Feature.Category.Primary,
|
||||
)
|
||||
)
|
||||
self._add_feature(
|
||||
@@ -78,6 +84,7 @@ class Emeter(Usage):
|
||||
unit="A",
|
||||
id="current_a", # for homeassistant backwards compat
|
||||
precision_hint=2,
|
||||
category=Feature.Category.Primary,
|
||||
)
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user