Remove Withings entity descriptions required fields mixins (#104008)

This commit is contained in:
Franck Nijhof 2023-11-15 06:31:10 +01:00 committed by GitHub
parent 182c40f16e
commit 8df7291abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,20 +58,13 @@ from .coordinator import (
from .entity import WithingsEntity
@dataclass
class WithingsMeasurementSensorEntityDescriptionMixin:
"""Mixin for describing withings data."""
@dataclass(kw_only=True)
class WithingsMeasurementSensorEntityDescription(SensorEntityDescription):
"""Immutable class for describing withings data."""
measurement_type: MeasurementType
@dataclass
class WithingsMeasurementSensorEntityDescription(
SensorEntityDescription, WithingsMeasurementSensorEntityDescriptionMixin
):
"""Immutable class for describing withings data."""
MEASUREMENT_SENSORS: dict[
MeasurementType, WithingsMeasurementSensorEntityDescription
] = {
@ -243,20 +236,13 @@ MEASUREMENT_SENSORS: dict[
}
@dataclass
class WithingsSleepSensorEntityDescriptionMixin:
"""Mixin for describing withings data."""
@dataclass(kw_only=True)
class WithingsSleepSensorEntityDescription(SensorEntityDescription):
"""Immutable class for describing withings data."""
value_fn: Callable[[SleepSummary], StateType]
@dataclass
class WithingsSleepSensorEntityDescription(
SensorEntityDescription, WithingsSleepSensorEntityDescriptionMixin
):
"""Immutable class for describing withings data."""
SLEEP_SENSORS = [
WithingsSleepSensorEntityDescription(
key="sleep_breathing_disturbances_intensity",
@ -410,20 +396,13 @@ SLEEP_SENSORS = [
]
@dataclass
class WithingsActivitySensorEntityDescriptionMixin:
"""Mixin for describing withings data."""
@dataclass(kw_only=True)
class WithingsActivitySensorEntityDescription(SensorEntityDescription):
"""Immutable class for describing withings data."""
value_fn: Callable[[Activity], StateType]
@dataclass
class WithingsActivitySensorEntityDescription(
SensorEntityDescription, WithingsActivitySensorEntityDescriptionMixin
):
"""Immutable class for describing withings data."""
ACTIVITY_SENSORS = [
WithingsActivitySensorEntityDescription(
key="activity_steps_today",
@ -514,20 +493,13 @@ SLEEP_GOAL = "sleep"
WEIGHT_GOAL = "weight"
@dataclass
class WithingsGoalsSensorEntityDescriptionMixin:
"""Mixin for describing withings data."""
@dataclass(kw_only=True)
class WithingsGoalsSensorEntityDescription(SensorEntityDescription):
"""Immutable class for describing withings data."""
value_fn: Callable[[Goals], StateType]
@dataclass
class WithingsGoalsSensorEntityDescription(
SensorEntityDescription, WithingsGoalsSensorEntityDescriptionMixin
):
"""Immutable class for describing withings data."""
GOALS_SENSORS: dict[str, WithingsGoalsSensorEntityDescription] = {
STEP_GOAL: WithingsGoalsSensorEntityDescription(
key="step_goal",
@ -558,20 +530,13 @@ GOALS_SENSORS: dict[str, WithingsGoalsSensorEntityDescription] = {
}
@dataclass
class WithingsWorkoutSensorEntityDescriptionMixin:
"""Mixin for describing withings data."""
@dataclass(kw_only=True)
class WithingsWorkoutSensorEntityDescription(SensorEntityDescription):
"""Immutable class for describing withings data."""
value_fn: Callable[[Workout], StateType]
@dataclass
class WithingsWorkoutSensorEntityDescription(
SensorEntityDescription, WithingsWorkoutSensorEntityDescriptionMixin
):
"""Immutable class for describing withings data."""
_WORKOUT_CATEGORY = [
workout_category.name.lower() for workout_category in WorkoutCategory
]