From d92411c1560b031eb44679c3f24f3a6835279570 Mon Sep 17 00:00:00 2001 From: Joostlek Date: Wed, 26 Mar 2025 10:33:24 +0100 Subject: [PATCH] Revert "Apply suggestions from code review" This reverts commit c6d39d38de1c8b8cc1a95d79a62b6658776375cc. --- .../components/smartthings/switch.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/smartthings/switch.py b/homeassistant/components/smartthings/switch.py index f253c01cbdb..5b190c7d372 100644 --- a/homeassistant/components/smartthings/switch.py +++ b/homeassistant/components/smartthings/switch.py @@ -168,15 +168,28 @@ class SmartThingsSwitch(SmartThingsEntity, SwitchEntity): return automations = automations_with_entity(self.hass, self.entity_id) scripts = scripts_with_entity(self.hass, self.entity_id) - if not automations and not scripts: + items = automations + scripts + if not items: return entity_reg: er.EntityRegistry = er.async_get(self.hass) + entity_automations = [ + automation_entity + for automation_id in automations + if (automation_entity := entity_reg.async_get(automation_id)) + ] + entity_scripts = [ + script_entity + for script_id in scripts + if (script_entity := entity_reg.async_get(script_id)) + ] + items_list = [ - f"- [{item.original_name}](/config/{integration}/edit/{item.unique_id})" - for integration, entities in (("automation", automations), ("script", scripts)) - for entity_id in entities - if (item := entity_reg.async_get(entity_id)) + f"- [{item.original_name}](/config/automation/edit/{item.unique_id})" + for item in entity_automations + ] + [ + f"- [{item.original_name}](/config/script/edit/{item.unique_id})" + for item in entity_scripts ] async_create_issue(