From e4f617e92e9b01dbf2f62cf6e9002aef3dee5148 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 1 Jul 2023 18:04:03 -0400 Subject: [PATCH] Update log message when referenced entity not found (#95577) * Update log message when referenced entity not found * Update homeassistant/helpers/service.py Co-authored-by: Martin Hjelmare * Update test --------- Co-authored-by: Martin Hjelmare --- homeassistant/helpers/service.py | 2 +- tests/helpers/test_service.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index fa0e57d501c..715a960de5d 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -240,7 +240,7 @@ class SelectedEntities: return _LOGGER.warning( - "Unable to find referenced %s or it is/they are currently not available", + "Referenced %s are missing or not currently available", ", ".join(parts), ) diff --git a/tests/helpers/test_service.py b/tests/helpers/test_service.py index f6299312b53..291a1744d20 100644 --- a/tests/helpers/test_service.py +++ b/tests/helpers/test_service.py @@ -1238,9 +1238,9 @@ async def test_entity_service_call_warn_referenced( ) await service.entity_service_call(hass, {}, "", call) assert ( - "Unable to find referenced areas non-existent-area, devices" - " non-existent-device, entities non.existent" in caplog.text - ) + "Referenced areas non-existent-area, devices non-existent-device, " + "entities non.existent are missing or not currently available" + ) in caplog.text async def test_async_extract_entities_warn_referenced( @@ -1259,9 +1259,9 @@ async def test_async_extract_entities_warn_referenced( extracted = await service.async_extract_entities(hass, {}, call) assert len(extracted) == 0 assert ( - "Unable to find referenced areas non-existent-area, devices" - " non-existent-device, entities non.existent" in caplog.text - ) + "Referenced areas non-existent-area, devices non-existent-device, " + "entities non.existent are missing or not currently available" + ) in caplog.text async def test_async_extract_config_entry_ids(hass: HomeAssistant) -> None: