Skip to content

Commit 343ea1b

Browse files
Return target in trigger description command (home-assistant#156766)
Co-authored-by: Artur Pragacz <[email protected]>
1 parent 36e1365 commit 343ea1b

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

homeassistant/helpers/trigger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ async def async_get_all_descriptions(
805805
continue
806806

807807
description = {"fields": yaml_description.get("fields", {})}
808+
if (target := yaml_description.get("target")) is not None:
809+
description["target"] = target
808810

809811
new_descriptions_cache[missing_trigger] = description
810812

tests/helpers/test_trigger.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,9 @@ async def test_async_get_all_descriptions(
647647
"""Test async_get_all_descriptions."""
648648
tag_trigger_descriptions = """
649649
_:
650-
fields:
650+
target:
651651
entity:
652-
selector:
653-
entity:
654-
filter:
655-
domain: alarm_control_panel
656-
supported_features:
657-
- alarm_control_panel.AlarmControlPanelEntityFeature.ARM_HOME
652+
domain: alarm_control_panel
658653
"""
659654

660655
assert await async_setup_component(hass, DOMAIN_SUN, {})
@@ -744,22 +739,14 @@ def _load_yaml(fname, secrets=None):
744739
}
745740
},
746741
"tag": {
747-
"fields": {
748-
"entity": {
749-
"selector": {
750-
"entity": {
751-
"filter": [
752-
{
753-
"domain": ["alarm_control_panel"],
754-
"supported_features": [1],
755-
}
756-
],
757-
"multiple": False,
758-
"reorder": False,
759-
},
760-
},
761-
},
762-
}
742+
"target": {
743+
"entity": [
744+
{
745+
"domain": ["alarm_control_panel"],
746+
}
747+
],
748+
},
749+
"fields": {},
763750
},
764751
}
765752

@@ -891,6 +878,5 @@ async def good_subscriber(new_triggers: set[str]):
891878
trigger.async_subscribe_platform_events(hass, good_subscriber)
892879

893880
assert await async_setup_component(hass, "sun", {})
894-
895881
assert trigger_events == [{"sun"}]
896882
assert "Error while notifying trigger platform listener" in caplog.text

0 commit comments

Comments
 (0)