From cdf3c07488f8d2e376a19386ea8456aed486aa66 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 19 Jan 2024 15:11:27 +0100 Subject: [PATCH] Add icon to entity registry list for display (#108313) --- homeassistant/helpers/entity_registry.py | 1 + tests/components/config/test_entity_registry.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 022fa045a3e..b6790ff0dc3 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -136,6 +136,7 @@ ReadOnlyEntityOptionsType = ReadOnlyDict[str, ReadOnlyDict[str, Any]] DISPLAY_DICT_OPTIONAL = ( ("ai", "area_id"), ("di", "device_id"), + ("ic", "icon"), ("tk", "translation_key"), ) diff --git a/tests/components/config/test_entity_registry.py b/tests/components/config/test_entity_registry.py index a002f2c2d50..46af23a6d1f 100644 --- a/tests/components/config/test_entity_registry.py +++ b/tests/components/config/test_entity_registry.py @@ -160,6 +160,7 @@ async def test_list_entities_for_display( entity_category=EntityCategory.DIAGNOSTIC, entity_id="test_domain.test", has_entity_name=True, + icon="mdi:icon", original_name="Hello World", platform="test_platform", translation_key="translations_galore", @@ -170,6 +171,7 @@ async def test_list_entities_for_display( device_id="device123", entity_id="test_domain.nameless", has_entity_name=True, + icon=None, original_name=None, platform="test_platform", unique_id="2345", @@ -231,6 +233,7 @@ async def test_list_entities_for_display( "ec": 1, "ei": "test_domain.test", "en": "Hello World", + "ic": "mdi:icon", "pl": "test_platform", "tk": "translations_galore", },