mirror of
https://github.com/home-assistant/core.git
synced 2025-08-09 23:55:07 +02:00
Apply suggestions from code review
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
committed by
GitHub
parent
0b419578c2
commit
c6d39d38de
@@ -168,28 +168,15 @@ class SmartThingsSwitch(SmartThingsEntity, SwitchEntity):
|
|||||||
return
|
return
|
||||||
automations = automations_with_entity(self.hass, self.entity_id)
|
automations = automations_with_entity(self.hass, self.entity_id)
|
||||||
scripts = scripts_with_entity(self.hass, self.entity_id)
|
scripts = scripts_with_entity(self.hass, self.entity_id)
|
||||||
items = automations + scripts
|
if not automations and not scripts:
|
||||||
if not items:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
entity_reg: er.EntityRegistry = er.async_get(self.hass)
|
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 = [
|
items_list = [
|
||||||
f"- [{item.original_name}](/config/automation/edit/{item.unique_id})"
|
f"- [{item.original_name}](/config/{integration}/edit/{item.unique_id})"
|
||||||
for item in entity_automations
|
for integration, entities in (("automation", automations), ("script", scripts))
|
||||||
] + [
|
for entity_id in entities
|
||||||
f"- [{item.original_name}](/config/script/edit/{item.unique_id})"
|
if (item := entity_reg.async_get(entity_id))
|
||||||
for item in entity_scripts
|
|
||||||
]
|
]
|
||||||
|
|
||||||
async_create_issue(
|
async_create_issue(
|
||||||
|
Reference in New Issue
Block a user