mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Remove entity description mixin in Schlage (#112934)
This commit is contained in:
parent
e4b43680e1
commit
da40e83fd9
@ -20,25 +20,13 @@ from .coordinator import LockData, SchlageDataUpdateCoordinator
|
||||
from .entity import SchlageEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SchlageBinarySensorEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
# NOTE: This has to be a mixin because these are required keys.
|
||||
# BinarySensorEntityDescription has attributes with default values,
|
||||
# which means we can't inherit from it because you haven't have
|
||||
# non-default arguments follow default arguments in an initializer.
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class SchlageBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""Entity description for a Schlage binary_sensor."""
|
||||
|
||||
value_fn: Callable[[LockData], bool]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SchlageBinarySensorEntityDescription(
|
||||
BinarySensorEntityDescription, SchlageBinarySensorEntityDescriptionMixin
|
||||
):
|
||||
"""Entity description for a Schlage binary_sensor."""
|
||||
|
||||
|
||||
_DESCRIPTIONS: tuple[SchlageBinarySensorEntityDescription] = (
|
||||
SchlageBinarySensorEntityDescription(
|
||||
key="keypad_disabled",
|
||||
|
@ -24,27 +24,15 @@ from .coordinator import SchlageDataUpdateCoordinator
|
||||
from .entity import SchlageEntity
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SchlageSwitchEntityDescriptionMixin:
|
||||
"""Mixin for required keys."""
|
||||
|
||||
# NOTE: This has to be a mixin because these are required keys.
|
||||
# SwitchEntityDescription has attributes with default values,
|
||||
# which means we can't inherit from it because you haven't have
|
||||
# non-default arguments follow default arguments in an initializer.
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class SchlageSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Entity description for a Schlage switch."""
|
||||
|
||||
on_fn: Callable[[Lock], None]
|
||||
off_fn: Callable[[Lock], None]
|
||||
value_fn: Callable[[Lock], bool]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SchlageSwitchEntityDescription(
|
||||
SwitchEntityDescription, SchlageSwitchEntityDescriptionMixin
|
||||
):
|
||||
"""Entity description for a Schlage switch."""
|
||||
|
||||
|
||||
SWITCHES: tuple[SchlageSwitchEntityDescription, ...] = (
|
||||
SchlageSwitchEntityDescription(
|
||||
key="beeper",
|
||||
|
Loading…
x
Reference in New Issue
Block a user