From 30f52b8d966de0b9d5768ed4ff11ae12365ed3d7 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 12 May 2023 15:17:01 +0200 Subject: [PATCH] Minor typing adjustment in entity_platform (#92978) --- homeassistant/helpers/entity_platform.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index 25140d0516f..4a2ff020fe2 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -622,10 +622,12 @@ class EntityPlatform: except RequiredParameterMissing: pass - if entity.entity_id is not None: + # An entity may suggest the entity_id by setting entity_id itself + suggested_entity_id: str | None = entity.entity_id + if suggested_entity_id is not None: suggested_object_id = split_entity_id(entity.entity_id)[1] else: - if device and entity.has_entity_name: # type: ignore[unreachable] + if device and entity.has_entity_name: device_name = device.name_by_user or device.name if not entity.name: suggested_object_id = device_name