diff --git a/homeassistant/components/minecraft_server/binary_sensor.py b/homeassistant/components/minecraft_server/binary_sensor.py index 707e60dc0db..de514754ef8 100644 --- a/homeassistant/components/minecraft_server/binary_sensor.py +++ b/homeassistant/components/minecraft_server/binary_sensor.py @@ -1,6 +1,5 @@ """The Minecraft Server binary sensor platform.""" -from dataclasses import dataclass from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, @@ -18,13 +17,8 @@ from .entity import MinecraftServerEntity KEY_STATUS = "status" -@dataclass(frozen=True) -class MinecraftServerBinarySensorEntityDescription(BinarySensorEntityDescription): - """Class describing Minecraft Server binary sensor entities.""" - - BINARY_SENSOR_DESCRIPTIONS = [ - MinecraftServerBinarySensorEntityDescription( + BinarySensorEntityDescription( key=KEY_STATUS, translation_key=KEY_STATUS, device_class=BinarySensorDeviceClass.CONNECTIVITY, @@ -52,12 +46,10 @@ async def async_setup_entry( class MinecraftServerBinarySensorEntity(MinecraftServerEntity, BinarySensorEntity): """Representation of a Minecraft Server binary sensor base entity.""" - entity_description: MinecraftServerBinarySensorEntityDescription - def __init__( self, coordinator: MinecraftServerCoordinator, - description: MinecraftServerBinarySensorEntityDescription, + description: BinarySensorEntityDescription, config_entry: ConfigEntry, ) -> None: """Initialize binary sensor base entity.""" diff --git a/homeassistant/components/minecraft_server/sensor.py b/homeassistant/components/minecraft_server/sensor.py index ada3e68bab7..4b862f54715 100644 --- a/homeassistant/components/minecraft_server/sensor.py +++ b/homeassistant/components/minecraft_server/sensor.py @@ -32,22 +32,15 @@ UNIT_PLAYERS_MAX = "players" UNIT_PLAYERS_ONLINE = "players" -@dataclass(frozen=True) -class MinecraftServerEntityDescriptionMixin: - """Mixin values for Minecraft Server entities.""" +@dataclass(frozen=True, kw_only=True) +class MinecraftServerSensorEntityDescription(SensorEntityDescription): + """Class describing Minecraft Server sensor entities.""" value_fn: Callable[[MinecraftServerData], StateType] attributes_fn: Callable[[MinecraftServerData], MutableMapping[str, Any]] | None supported_server_types: set[MinecraftServerType] -@dataclass(frozen=True) -class MinecraftServerSensorEntityDescription( - SensorEntityDescription, MinecraftServerEntityDescriptionMixin -): - """Class describing Minecraft Server sensor entities.""" - - def get_extra_state_attributes_players_list( data: MinecraftServerData, ) -> dict[str, list[str]]: