File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
homeassistant/components/template
tests/components/template Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 4646 CONF_DEFAULT_ENTITY_ID ,
4747 CONF_PICTURE ,
4848 DOMAIN ,
49+ PLATFORMS ,
4950)
5051from .entity import AbstractTemplateEntity
5152from .template_entity import TemplateEntity
@@ -234,6 +235,8 @@ def create_legacy_template_issue(
234235 hass : HomeAssistant , config : ConfigType , domain : str
235236) -> None :
236237 """Create a repair for legacy template entities."""
238+ if domain not in PLATFORMS :
239+ return
237240
238241 breadcrumb = "Template Entity"
239242 # Default entity id should be in most legacy configuration because
Original file line number Diff line number Diff line change 1313from homeassistant .components .template .fan import LEGACY_FIELDS as FAN_LEGACY_FIELDS
1414from homeassistant .components .template .helpers import (
1515 async_setup_template_platform ,
16+ create_legacy_template_issue ,
1617 format_migration_config ,
1718 rewrite_legacy_to_modern_config ,
1819 rewrite_legacy_to_modern_configs ,
@@ -637,3 +638,40 @@ async def test_yaml_config_recursion_depth(hass: HomeAssistant) -> None:
637638
638639 with pytest .raises (RecursionError ):
639640 format_migration_config ({1 : {2 : {3 : {4 : {5 : {6 : [{7 : {8 : {9 : {10 : {}}}}}]}}}}}})
641+
642+
643+ @pytest .mark .parametrize (
644+ ("domain" , "config" ),
645+ [
646+ (
647+ "media_player" ,
648+ {
649+ "media_player" : {
650+ "platform" : "template" ,
651+ "name" : "My Media Player" ,
652+ "unique_id" : "Foobar" ,
653+ },
654+ },
655+ ),
656+ (
657+ "climate" ,
658+ {
659+ "climate" : {
660+ "platform" : "template" ,
661+ "name" : "My Climate" ,
662+ "unique_id" : "Foobar" ,
663+ },
664+ },
665+ ),
666+ ],
667+ )
668+ async def test_custom_integration_deprecation (
669+ hass : HomeAssistant ,
670+ domain : str ,
671+ config : dict ,
672+ issue_registry : ir .IssueRegistry ,
673+ ) -> None :
674+ """Test that custom integrations do not create deprecations."""
675+
676+ create_legacy_template_issue (hass , config , domain )
677+ assert len (issue_registry .issues ) == 0
You can’t perform that action at this time.
0 commit comments