Replace None constants [minecraft_server] (#86540)

This commit is contained in:
Marc Mueller 2023-01-24 16:34:04 +01:00 committed by GitHub
parent f8c0e80ef7
commit d36d98937d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 12 deletions

View File

@ -36,6 +36,3 @@ SRV_RECORD_PREFIX = "_minecraft._tcp"
UNIT_PLAYERS_MAX = "players" UNIT_PLAYERS_MAX = "players"
UNIT_PLAYERS_ONLINE = "players" UNIT_PLAYERS_ONLINE = "players"
UNIT_PROTOCOL_VERSION = None
UNIT_VERSION = None
UNIT_MOTD = None

View File

@ -23,11 +23,8 @@ from .const import (
NAME_PLAYERS_ONLINE, NAME_PLAYERS_ONLINE,
NAME_PROTOCOL_VERSION, NAME_PROTOCOL_VERSION,
NAME_VERSION, NAME_VERSION,
UNIT_MOTD,
UNIT_PLAYERS_MAX, UNIT_PLAYERS_MAX,
UNIT_PLAYERS_ONLINE, UNIT_PLAYERS_ONLINE,
UNIT_PROTOCOL_VERSION,
UNIT_VERSION,
) )
@ -61,7 +58,7 @@ class MinecraftServerSensorEntity(MinecraftServerEntity, SensorEntity):
server: MinecraftServer, server: MinecraftServer,
type_name: str, type_name: str,
icon: str, icon: str,
unit: str | None, unit: str | None = None,
device_class: str | None = None, device_class: str | None = None,
) -> None: ) -> None:
"""Initialize sensor base entity.""" """Initialize sensor base entity."""
@ -79,9 +76,7 @@ class MinecraftServerVersionSensor(MinecraftServerSensorEntity):
def __init__(self, server: MinecraftServer) -> None: def __init__(self, server: MinecraftServer) -> None:
"""Initialize version sensor.""" """Initialize version sensor."""
super().__init__( super().__init__(server=server, type_name=NAME_VERSION, icon=ICON_VERSION)
server=server, type_name=NAME_VERSION, icon=ICON_VERSION, unit=UNIT_VERSION
)
async def async_update(self) -> None: async def async_update(self) -> None:
"""Update version.""" """Update version."""
@ -97,7 +92,6 @@ class MinecraftServerProtocolVersionSensor(MinecraftServerSensorEntity):
server=server, server=server,
type_name=NAME_PROTOCOL_VERSION, type_name=NAME_PROTOCOL_VERSION,
icon=ICON_PROTOCOL_VERSION, icon=ICON_PROTOCOL_VERSION,
unit=UNIT_PROTOCOL_VERSION,
) )
async def async_update(self) -> None: async def async_update(self) -> None:
@ -173,7 +167,6 @@ class MinecraftServerMOTDSensor(MinecraftServerSensorEntity):
server=server, server=server,
type_name=NAME_MOTD, type_name=NAME_MOTD,
icon=ICON_MOTD, icon=ICON_MOTD,
unit=UNIT_MOTD,
) )
async def async_update(self) -> None: async def async_update(self) -> None: