From 00df80d38b9719eaa27653eb0eb7865ef4118bb2 Mon Sep 17 00:00:00 2001 From: elmurato <1382097+elmurato@users.noreply.github.com> Date: Fri, 23 Oct 2026 14:13:31 +0200 Subject: [PATCH] Set device entry type of minecraft_server to service (#188182) --- .../components/minecraft_server/entity.py | 3 +- .../components/minecraft_server/test_init.py | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/minecraft_server/entity.py b/homeassistant/components/minecraft_server/entity.py index 3a6c070e6a4b..c27d5bd8d4fa 100644 --- a/homeassistant/components/minecraft_server/entity.py +++ b/homeassistant/components/minecraft_server/entity.py @@ -2,7 +2,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_TYPE -from homeassistant.helpers.device_registry import DeviceInfo +from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .api import MinecraftServerType @@ -26,6 +26,7 @@ class MinecraftServerEntity(CoordinatorEntity[MinecraftServerCoordinator]): super().__init__(coordinator) self._attr_device_info = DeviceInfo( + entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, config_entry.entry_id)}, manufacturer=MANUFACTURER, model=( diff --git a/tests/components/minecraft_server/test_init.py b/tests/components/minecraft_server/test_init.py index a1b96136dd61..571ab77b0cfd 100644 --- a/tests/components/minecraft_server/test_init.py +++ b/tests/components/minecraft_server/test_init.py @@ -339,3 +339,32 @@ async def test_entry_migration_v3_failure( assert v1_mock_config_entry.error_reason_translation_placeholders == { "address": f"{TEST_HOST}:{TEST_PORT}" } + + +async def test_device_entry_type( + hass: HomeAssistant, + java_mock_config_entry: MockConfigEntry, + device_registry: dr.DeviceRegistry, +) -> None: + """Test the device entry type.""" + java_mock_config_entry.add_to_hass(hass) + + with ( + patch( + "homeassistant.components.minecraft_server.api.JavaServer.async_lookup", + return_value=JavaServer(host=TEST_HOST, port=TEST_PORT), + ), + patch( + "homeassistant.components.minecraft_server.api.JavaServer.async_status", + return_value=TEST_JAVA_STATUS_RESPONSE, + ), + ): + assert await hass.config_entries.async_setup(java_mock_config_entry.entry_id) + await hass.async_block_till_done() + + device = device_registry.async_get_device_by_identifier( + (DOMAIN, java_mock_config_entry.entry_id), + java_mock_config_entry.entry_id, + ) + assert device is not None + assert device.entry_type is dr.DeviceEntryType.SERVICE