Make it possible to list debug traces for a specific automation (#47744)

This commit is contained in:
Erik Montnemery 2021-03-16 00:51:04 +01:00 committed by GitHub
parent 5f627df6f8
commit f82e59c32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 86 additions and 39 deletions

View file

@ -109,6 +109,7 @@ class AutomationTrace:
trigger = self._variables.get("trigger", {}).get("description")
result = {
"automation_id": self._unique_id,
"last_action": last_action,
"last_condition": last_condition,
"run_id": self.run_id,
@ -196,11 +197,9 @@ def get_debug_traces_for_automation(hass, automation_id, summary=False):
@callback
def get_debug_traces(hass, summary=False):
"""Return a serializable list of debug traces."""
traces = {}
traces = []
for automation_id in hass.data[DATA_AUTOMATION_TRACE]:
traces[automation_id] = get_debug_traces_for_automation(
hass, automation_id, summary
)
traces.extend(get_debug_traces_for_automation(hass, automation_id, summary))
return traces