Require explicit feature type (#1006)

Explicit > implicit. Having this previously would have avoided using a
wrong type for water_alert in the first place.
This commit is contained in:
Teemu R
2024-06-25 18:30:36 +02:00
committed by GitHub
parent 5846bbdbbb
commit 0f5bafaa43
15 changed files with 45 additions and 10 deletions

View File

@@ -44,6 +44,7 @@ class Energy(Module, ABC):
id="current_consumption",
precision_hint=1,
category=Feature.Category.Primary,
type=Feature.Type.Sensor,
)
)
self._add_feature(
@@ -56,6 +57,7 @@ class Energy(Module, ABC):
id="consumption_today",
precision_hint=3,
category=Feature.Category.Info,
type=Feature.Type.Sensor,
)
)
self._add_feature(
@@ -68,6 +70,7 @@ class Energy(Module, ABC):
unit="kWh",
precision_hint=3,
category=Feature.Category.Info,
type=Feature.Type.Sensor,
)
)
if self.supports(self.ModuleFeature.CONSUMPTION_TOTAL):
@@ -81,6 +84,7 @@ class Energy(Module, ABC):
id="consumption_total",
precision_hint=3,
category=Feature.Category.Info,
type=Feature.Type.Sensor,
)
)
if self.supports(self.ModuleFeature.VOLTAGE_CURRENT):
@@ -94,6 +98,7 @@ class Energy(Module, ABC):
id="voltage",
precision_hint=1,
category=Feature.Category.Primary,
type=Feature.Type.Sensor,
)
)
self._add_feature(
@@ -106,6 +111,7 @@ class Energy(Module, ABC):
id="current",
precision_hint=2,
category=Feature.Category.Primary,
type=Feature.Type.Sensor,
)
)