From 73a1474ba99cc844c664ef867e5efa465ef08a01 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 26 May 2023 16:43:39 +0200 Subject: [PATCH] Repairs: Ignore invalid entity IDs in all cases --- .../spook/repairs/automation_unknown_entity_references.py | 2 ++ custom_components/spook/repairs/group_unknown_members.py | 2 ++ .../spook/repairs/lovelace_unknown_entity_references.py | 3 ++- .../spook/repairs/script_unknown_entity_references.py | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/custom_components/spook/repairs/automation_unknown_entity_references.py b/custom_components/spook/repairs/automation_unknown_entity_references.py index faf4f616..324a6aa1 100644 --- a/custom_components/spook/repairs/automation_unknown_entity_references.py +++ b/custom_components/spook/repairs/automation_unknown_entity_references.py @@ -10,6 +10,7 @@ ENTITY_MATCH_NONE, EVENT_COMPONENT_LOADED, ) +from homeassistant.core import valid_entity_id from homeassistant.helpers import entity_registry as er from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_component import DATA_INSTANCES, EntityComponent @@ -106,6 +107,7 @@ async def async_inspect(self) -> None: ), ) and entity_id not in entity_ids + and valid_entity_id(entity_id) ) }: self.async_create_issue( diff --git a/custom_components/spook/repairs/group_unknown_members.py b/custom_components/spook/repairs/group_unknown_members.py index 4896fbe7..d0cc994f 100644 --- a/custom_components/spook/repairs/group_unknown_members.py +++ b/custom_components/spook/repairs/group_unknown_members.py @@ -7,6 +7,7 @@ ENTITY_MATCH_NONE, EVENT_COMPONENT_LOADED, ) +from homeassistant.core import valid_entity_id from homeassistant.helpers import entity_registry as er from homeassistant.helpers.entity_platform import DATA_ENTITY_PLATFORM, EntityPlatform @@ -83,6 +84,7 @@ async def async_inspect(self) -> None: ("device_tracker.", "group.", "scene."), ) and entity_id not in entity_ids + and valid_entity_id(entity_id) ) }: self.async_create_issue( diff --git a/custom_components/spook/repairs/lovelace_unknown_entity_references.py b/custom_components/spook/repairs/lovelace_unknown_entity_references.py index 42db40bd..b533895e 100644 --- a/custom_components/spook/repairs/lovelace_unknown_entity_references.py +++ b/custom_components/spook/repairs/lovelace_unknown_entity_references.py @@ -11,7 +11,7 @@ ENTITY_MATCH_NONE, EVENT_COMPONENT_LOADED, ) -from homeassistant.core import callback +from homeassistant.core import callback, valid_entity_id from homeassistant.helpers import entity_registry as er from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -117,6 +117,7 @@ async def async_inspect(self) -> None: ), ) and entity_id not in entity_ids + and valid_entity_id(entity_id) ) }: title = "Overview" diff --git a/custom_components/spook/repairs/script_unknown_entity_references.py b/custom_components/spook/repairs/script_unknown_entity_references.py index 2ca948eb..a2c74955 100644 --- a/custom_components/spook/repairs/script_unknown_entity_references.py +++ b/custom_components/spook/repairs/script_unknown_entity_references.py @@ -10,6 +10,7 @@ ENTITY_MATCH_NONE, EVENT_COMPONENT_LOADED, ) +from homeassistant.core import valid_entity_id from homeassistant.helpers import entity_registry as er from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_component import DATA_INSTANCES, EntityComponent @@ -107,6 +108,7 @@ async def async_inspect(self) -> None: ), ) and entity_id not in entity_ids + and valid_entity_id(entity_id) ) }: self.async_create_issue(