diff --git a/homeassistant/components/minecraft_server/binary_sensor.py b/homeassistant/components/minecraft_server/binary_sensor.py index 42f101aa07e7f..51e125702ddbf 100644 --- a/homeassistant/components/minecraft_server/binary_sensor.py +++ b/homeassistant/components/minecraft_server/binary_sensor.py @@ -20,12 +20,14 @@ class MinecraftServerBinarySensorEntityDescription(BinarySensorEntityDescription """Class describing Minecraft Server binary sensor entities.""" -STATUS_BINARY_SENSOR_DESCRIPTION = MinecraftServerBinarySensorEntityDescription( - key=KEY_STATUS, - translation_key=KEY_STATUS, - device_class=BinarySensorDeviceClass.CONNECTIVITY, - icon=ICON_STATUS, -) +BINARY_SENSOR_DESCRIPTIONS = [ + MinecraftServerBinarySensorEntityDescription( + key=KEY_STATUS, + translation_key=KEY_STATUS, + device_class=BinarySensorDeviceClass.CONNECTIVITY, + icon=ICON_STATUS, + ), +] async def async_setup_entry( @@ -36,13 +38,14 @@ async def async_setup_entry( """Set up the Minecraft Server binary sensor platform.""" server = hass.data[DOMAIN][config_entry.entry_id] - # Create entities list. - entities = [ - MinecraftServerBinarySensorEntity(server, STATUS_BINARY_SENSOR_DESCRIPTION) - ] - # Add binary sensor entities. - async_add_entities(entities, True) + async_add_entities( + [ + MinecraftServerBinarySensorEntity(server=server, description=description) + for description in BINARY_SENSOR_DESCRIPTIONS + ], + True, + ) class MinecraftServerBinarySensorEntity(MinecraftServerEntity, BinarySensorEntity): diff --git a/homeassistant/components/minecraft_server/sensor.py b/homeassistant/components/minecraft_server/sensor.py index 0fbaf495365a6..ae128047778be 100644 --- a/homeassistant/components/minecraft_server/sensor.py +++ b/homeassistant/components/minecraft_server/sensor.py @@ -120,16 +120,14 @@ async def async_setup_entry( """Set up the Minecraft Server sensor platform.""" server = hass.data[DOMAIN][config_entry.entry_id] - # Create entities list. - entities = [] - - for description in SENSOR_DESCRIPTIONS: - entities.append( - MinecraftServerSensorEntity(server=server, description=description) - ) - # Add sensor entities. - async_add_entities(entities, True) + async_add_entities( + [ + MinecraftServerSensorEntity(server=server, description=description) + for description in SENSOR_DESCRIPTIONS + ], + True, + ) class MinecraftServerSensorEntity(MinecraftServerEntity, SensorEntity):