Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove name in Minecraft Server config entry #139113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions homeassistant/components/minecraft_server/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TYPE
from homeassistant.const import CONF_ADDRESS, CONF_TYPE

from .api import MinecraftServer, MinecraftServerAddressError, MinecraftServerType
from .const import DEFAULT_NAME, DOMAIN
from .const import DOMAIN

DEFAULT_ADDRESS = "localhost:25565"

Expand All @@ -37,7 +37,6 @@ async def async_step_user(

# Prepare config entry data.
config_data = {
CONF_NAME: user_input[CONF_NAME],
CONF_ADDRESS: address,
}

Expand Down Expand Up @@ -78,9 +77,6 @@ def _show_config_form(
step_id="user",
data_schema=vol.Schema(
{
vol.Required(
CONF_NAME, default=user_input.get(CONF_NAME, DEFAULT_NAME)
): str,
vol.Required(
CONF_ADDRESS,
default=user_input.get(CONF_ADDRESS, DEFAULT_ADDRESS),
Expand Down
2 changes: 0 additions & 2 deletions homeassistant/components/minecraft_server/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Constants for the Minecraft Server integration."""

DEFAULT_NAME = "Minecraft Server"

DOMAIN = "minecraft_server"

KEY_LATENCY = "latency"
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/minecraft_server/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TYPE
from homeassistant.const import CONF_ADDRESS, CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand Down Expand Up @@ -42,7 +42,7 @@ def __init__(

super().__init__(
hass=hass,
name=config_entry.data[CONF_NAME],
name=config_entry.title,
config_entry=config_entry,
logger=_LOGGER,
update_interval=SCAN_INTERVAL,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/minecraft_server/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from typing import Any

from homeassistant.components.diagnostics import async_redact_data
from homeassistant.const import CONF_ADDRESS, CONF_NAME
from homeassistant.const import CONF_ADDRESS
from homeassistant.core import HomeAssistant

from .coordinator import MinecraftServerConfigEntry

TO_REDACT: Iterable[Any] = {CONF_ADDRESS, CONF_NAME, "players_list"}
TO_REDACT: Iterable[Any] = {CONF_ADDRESS, "players_list"}


async def async_get_config_entry_diagnostics(
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/minecraft_server/quality_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ rules:
appropriate-polling: done
brands: done
common-modules: done
config-flow:
status: todo
comment: Check removal and replacement of name in config flow with the title (server address).
config-flow: done
config-flow-test-coverage:
status: todo
comment: |
Expand Down
10 changes: 6 additions & 4 deletions homeassistant/components/minecraft_server/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"config": {
"step": {
"user": {
"title": "Link your Minecraft Server",
"description": "Set up your Minecraft Server instance to allow monitoring.",
"data": {
"name": "[%key:common::config_flow::data::name%]",
"address": "Server address"
}
},
"data_description": {
"address": "The hostname, IP address or SRV record of your Minecraft server, optionally including the port."
},
"title": "Link your Minecraft Server",
"description": "Set up your Minecraft Server instance to allow monitoring."
}
},
"abort": {
Expand Down
8 changes: 4 additions & 4 deletions tests/components/minecraft_server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pytest

from homeassistant.components.minecraft_server.api import MinecraftServerType
from homeassistant.components.minecraft_server.const import DEFAULT_NAME, DOMAIN
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TYPE
from homeassistant.components.minecraft_server.const import DOMAIN
from homeassistant.const import CONF_ADDRESS, CONF_TYPE

from .const import TEST_ADDRESS, TEST_CONFIG_ENTRY_ID

Expand All @@ -18,8 +18,8 @@ def java_mock_config_entry() -> MockConfigEntry:
domain=DOMAIN,
unique_id=None,
entry_id=TEST_CONFIG_ENTRY_ID,
title=TEST_ADDRESS,
data={
CONF_NAME: DEFAULT_NAME,
CONF_ADDRESS: TEST_ADDRESS,
CONF_TYPE: MinecraftServerType.JAVA_EDITION,
},
Expand All @@ -34,8 +34,8 @@ def bedrock_mock_config_entry() -> MockConfigEntry:
domain=DOMAIN,
unique_id=None,
entry_id=TEST_CONFIG_ENTRY_ID,
title=TEST_ADDRESS,
data={
CONF_NAME: DEFAULT_NAME,
CONF_ADDRESS: TEST_ADDRESS,
CONF_TYPE: MinecraftServerType.BEDROCK_EDITION,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'connectivity',
'friendly_name': 'Minecraft Server Status',
'friendly_name': 'mc.dummyserver.com:25566 Status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.minecraft_server_status',
'entity_id': 'binary_sensor.mc_dummyserver_com_25566_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
Expand All @@ -17,10 +17,10 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'connectivity',
'friendly_name': 'Minecraft Server Status',
'friendly_name': 'mc.dummyserver.com:25566 Status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.minecraft_server_status',
'entity_id': 'binary_sensor.mc_dummyserver_com_25566_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
Expand All @@ -31,10 +31,10 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'connectivity',
'friendly_name': 'Minecraft Server Status',
'friendly_name': 'mc.dummyserver.com:25566 Status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.minecraft_server_status',
'entity_id': 'binary_sensor.mc_dummyserver_com_25566_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
Expand All @@ -45,10 +45,10 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'connectivity',
'friendly_name': 'Minecraft Server Status',
'friendly_name': 'mc.dummyserver.com:25566 Status',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.minecraft_server_status',
'entity_id': 'binary_sensor.mc_dummyserver_com_25566_status',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
}),
'config_entry_data': dict({
'address': '**REDACTED**',
'name': '**REDACTED**',
'type': 'Bedrock Edition',
}),
'config_entry_options': dict({
Expand Down Expand Up @@ -36,7 +35,6 @@
}),
'config_entry_data': dict({
'address': '**REDACTED**',
'name': '**REDACTED**',
'type': 'Java Edition',
}),
'config_entry_options': dict({
Expand Down
Loading