diff --git a/homeassistant/components/template/helpers.py b/homeassistant/components/template/helpers.py index be506a138ea..d0c5f4d488a 100644 --- a/homeassistant/components/template/helpers.py +++ b/homeassistant/components/template/helpers.py @@ -46,6 +46,7 @@ from .const import ( CONF_DEFAULT_ENTITY_ID, CONF_PICTURE, DOMAIN, + PLATFORMS, ) from .entity import AbstractTemplateEntity from .template_entity import TemplateEntity @@ -234,6 +235,8 @@ def create_legacy_template_issue( hass: HomeAssistant, config: ConfigType, domain: str ) -> None: """Create a repair for legacy template entities.""" + if domain not in PLATFORMS: + return breadcrumb = "Template Entity" # Default entity id should be in most legacy configuration because diff --git a/tests/components/template/test_helpers.py b/tests/components/template/test_helpers.py index 08544f5f7ed..d033ee8269b 100644 --- a/tests/components/template/test_helpers.py +++ b/tests/components/template/test_helpers.py @@ -13,6 +13,7 @@ from homeassistant.components.template.cover import LEGACY_FIELDS as COVER_LEGAC from homeassistant.components.template.fan import LEGACY_FIELDS as FAN_LEGACY_FIELDS from homeassistant.components.template.helpers import ( async_setup_template_platform, + create_legacy_template_issue, format_migration_config, rewrite_legacy_to_modern_config, rewrite_legacy_to_modern_configs, @@ -637,3 +638,40 @@ async def test_yaml_config_recursion_depth(hass: HomeAssistant) -> None: with pytest.raises(RecursionError): format_migration_config({1: {2: {3: {4: {5: {6: [{7: {8: {9: {10: {}}}}}]}}}}}}) + + +@pytest.mark.parametrize( + ("domain", "config"), + [ + ( + "media_player", + { + "media_player": { + "platform": "template", + "name": "My Media Player", + "unique_id": "Foobar", + }, + }, + ), + ( + "climate", + { + "climate": { + "platform": "template", + "name": "My Climate", + "unique_id": "Foobar", + }, + }, + ), + ], +) +async def test_custom_integration_deprecation( + hass: HomeAssistant, + domain: str, + config: dict, + issue_registry: ir.IssueRegistry, +) -> None: + """Test that custom integrations do not create deprecations.""" + + create_legacy_template_issue(hass, config, domain) + assert len(issue_registry.issues) == 0