Remove deprecated props from entity platform (#175606)

This commit is contained in:
G Johansson
2026-07-08 23:31:21 +02:00
committed by GitHub
parent 2f16026d0b
commit 5ec3d4d5ef
2 changed files with 0 additions and 125 deletions
-72
View File
@@ -38,7 +38,6 @@ from homeassistant.util.async_ import create_eager_task
from homeassistant.util.hass_dict import HassKey
from . import device_registry as dr, entity_registry as er, service, translation
from .deprecation import deprecated_function
from .entity_registry import EntityRegistry, RegistryEntryDisabler, RegistryEntryHider
from .event import async_call_later
from .frame import report_usage
@@ -1233,77 +1232,6 @@ class EntityPlatform:
"""Return the platform name (e.g hue)."""
return self.platform_data.platform_name
@property
@deprecated_function(
"platform_data.component_translations",
breaks_in_ha_version="2026.8",
)
def component_translations(self) -> dict[str, str]:
"""Return the component translations.
Will be removed in Home Assistant Core 2026.8.
"""
return self.platform_data.component_translations
@property
@deprecated_function(
"platform_data.platform_translations",
breaks_in_ha_version="2026.8",
)
def platform_translations(self) -> dict[str, str]:
"""Return the platform translations.
Will be removed in Home Assistant Core 2026.8.
"""
return self.platform_data.platform_translations
@property
@deprecated_function(
"platform_data.object_id_component_translations",
breaks_in_ha_version="2026.8",
)
def object_id_component_translations(self) -> dict[str, str]:
"""Return the object ID component translations.
Will be removed in Home Assistant Core 2026.8.
"""
return self.platform_data.object_id_component_translations
@property
@deprecated_function(
"platform_data.object_id_platform_translations",
breaks_in_ha_version="2026.8",
)
def object_id_platform_translations(self) -> dict[str, str]:
"""Return the object ID platform translations.
Will be removed in Home Assistant Core 2026.8.
"""
return self.platform_data.object_id_platform_translations
@property
@deprecated_function(
"platform_data.default_language_platform_translations",
breaks_in_ha_version="2026.8",
)
def default_language_platform_translations(self) -> dict[str, str]:
"""Return the default language platform translations.
Will be removed in Home Assistant Core 2026.8.
"""
return self.platform_data.default_language_platform_translations
@deprecated_function(
"platform_data.async_load_translations",
breaks_in_ha_version="2026.8",
)
async def async_load_translations(self) -> None:
"""Load translations.
Will be removed in Home Assistant Core 2026.8.
"""
return await self.platform_data.async_load_translations()
@overload
def _async_derive_object_ids(
-53
View File
@@ -2837,56 +2837,3 @@ async def test_add_entity_unknown_subentry(
"Can't add entities to unknown subentry unknown-subentry "
"of config entry super-mock-id"
) in caplog.text
@pytest.mark.parametrize("integration_frame_path", ["custom_components/my_integration"])
@pytest.mark.usefixtures("mock_integration_frame")
@pytest.mark.parametrize(
"deprecated_attribute",
[
"component_translations",
"platform_translations",
"object_id_component_translations",
"object_id_platform_translations",
"default_language_platform_translations",
],
)
async def test_deprecated_attributes(
hass: HomeAssistant,
deprecated_attribute: str,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test setting the device name based on input info."""
platform = MockPlatform()
entity_platform = MockEntityPlatform(hass, platform_name="test", platform=platform)
assert getattr(entity_platform, deprecated_attribute) is getattr(
entity_platform.platform_data, deprecated_attribute
)
assert (
f"The deprecated function {deprecated_attribute} was called from "
"my_integration. It will be removed in HA Core 2026.8. Use platform_data."
f"{deprecated_attribute} instead, please report it to the author of the "
"'my_integration' custom integration" in caplog.text
)
@pytest.mark.parametrize("integration_frame_path", ["custom_components/my_integration"])
@pytest.mark.usefixtures("mock_integration_frame")
async def test_deprecated_async_load_translations(
hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test setting the device name based on input info."""
platform = MockPlatform()
entity_platform = MockEntityPlatform(hass, platform_name="test", platform=platform)
await entity_platform.async_load_translations()
assert (
"The deprecated function async_load_translations was called from "
"my_integration. It will be removed in HA Core 2026.8. Use platform_data."
"async_load_translations instead, please report it to the author of the "
"'my_integration' custom integration" in caplog.text
)