mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove Withings entity descriptions required fields mixins (#104008)
This commit is contained in:
parent
182c40f16e
commit
8df7291abb
@ -58,20 +58,13 @@ from .coordinator import (
|
|||||||
from .entity import WithingsEntity
|
from .entity import WithingsEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WithingsMeasurementSensorEntityDescriptionMixin:
|
class WithingsMeasurementSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for describing withings data."""
|
"""Immutable class for describing withings data."""
|
||||||
|
|
||||||
measurement_type: MeasurementType
|
measurement_type: MeasurementType
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WithingsMeasurementSensorEntityDescription(
|
|
||||||
SensorEntityDescription, WithingsMeasurementSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Immutable class for describing withings data."""
|
|
||||||
|
|
||||||
|
|
||||||
MEASUREMENT_SENSORS: dict[
|
MEASUREMENT_SENSORS: dict[
|
||||||
MeasurementType, WithingsMeasurementSensorEntityDescription
|
MeasurementType, WithingsMeasurementSensorEntityDescription
|
||||||
] = {
|
] = {
|
||||||
@ -243,20 +236,13 @@ MEASUREMENT_SENSORS: dict[
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WithingsSleepSensorEntityDescriptionMixin:
|
class WithingsSleepSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for describing withings data."""
|
"""Immutable class for describing withings data."""
|
||||||
|
|
||||||
value_fn: Callable[[SleepSummary], StateType]
|
value_fn: Callable[[SleepSummary], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WithingsSleepSensorEntityDescription(
|
|
||||||
SensorEntityDescription, WithingsSleepSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Immutable class for describing withings data."""
|
|
||||||
|
|
||||||
|
|
||||||
SLEEP_SENSORS = [
|
SLEEP_SENSORS = [
|
||||||
WithingsSleepSensorEntityDescription(
|
WithingsSleepSensorEntityDescription(
|
||||||
key="sleep_breathing_disturbances_intensity",
|
key="sleep_breathing_disturbances_intensity",
|
||||||
@ -410,20 +396,13 @@ SLEEP_SENSORS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WithingsActivitySensorEntityDescriptionMixin:
|
class WithingsActivitySensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for describing withings data."""
|
"""Immutable class for describing withings data."""
|
||||||
|
|
||||||
value_fn: Callable[[Activity], StateType]
|
value_fn: Callable[[Activity], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WithingsActivitySensorEntityDescription(
|
|
||||||
SensorEntityDescription, WithingsActivitySensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Immutable class for describing withings data."""
|
|
||||||
|
|
||||||
|
|
||||||
ACTIVITY_SENSORS = [
|
ACTIVITY_SENSORS = [
|
||||||
WithingsActivitySensorEntityDescription(
|
WithingsActivitySensorEntityDescription(
|
||||||
key="activity_steps_today",
|
key="activity_steps_today",
|
||||||
@ -514,20 +493,13 @@ SLEEP_GOAL = "sleep"
|
|||||||
WEIGHT_GOAL = "weight"
|
WEIGHT_GOAL = "weight"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WithingsGoalsSensorEntityDescriptionMixin:
|
class WithingsGoalsSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for describing withings data."""
|
"""Immutable class for describing withings data."""
|
||||||
|
|
||||||
value_fn: Callable[[Goals], StateType]
|
value_fn: Callable[[Goals], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WithingsGoalsSensorEntityDescription(
|
|
||||||
SensorEntityDescription, WithingsGoalsSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Immutable class for describing withings data."""
|
|
||||||
|
|
||||||
|
|
||||||
GOALS_SENSORS: dict[str, WithingsGoalsSensorEntityDescription] = {
|
GOALS_SENSORS: dict[str, WithingsGoalsSensorEntityDescription] = {
|
||||||
STEP_GOAL: WithingsGoalsSensorEntityDescription(
|
STEP_GOAL: WithingsGoalsSensorEntityDescription(
|
||||||
key="step_goal",
|
key="step_goal",
|
||||||
@ -558,20 +530,13 @@ GOALS_SENSORS: dict[str, WithingsGoalsSensorEntityDescription] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(kw_only=True)
|
||||||
class WithingsWorkoutSensorEntityDescriptionMixin:
|
class WithingsWorkoutSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Mixin for describing withings data."""
|
"""Immutable class for describing withings data."""
|
||||||
|
|
||||||
value_fn: Callable[[Workout], StateType]
|
value_fn: Callable[[Workout], StateType]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WithingsWorkoutSensorEntityDescription(
|
|
||||||
SensorEntityDescription, WithingsWorkoutSensorEntityDescriptionMixin
|
|
||||||
):
|
|
||||||
"""Immutable class for describing withings data."""
|
|
||||||
|
|
||||||
|
|
||||||
_WORKOUT_CATEGORY = [
|
_WORKOUT_CATEGORY = [
|
||||||
workout_category.name.lower() for workout_category in WorkoutCategory
|
workout_category.name.lower() for workout_category in WorkoutCategory
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user