diff --git a/src/panels/config/automation/trace/ha-automation-trace-path-details.ts b/src/panels/config/automation/trace/ha-automation-trace-path-details.ts index 2416ea2ad6..51ebbdab7f 100644 --- a/src/panels/config/automation/trace/ha-automation-trace-path-details.ts +++ b/src/panels/config/automation/trace/ha-automation-trace-path-details.ts @@ -99,33 +99,63 @@ export class HaAutomationTracePathDetails extends LitElement { return "This node was not executed and so no further trace information is available."; } - const data: ActionTraceStep[] = paths[this.selected.path]; + const parts: TemplateResult[][] = []; - return data.map((trace, idx) => { - const { - path, - timestamp, - result, - error, - changed_variables, - ...rest - } = trace as any; + let active = false; + const childConditionsPrefix = `${this.selected.path}/conditions/`; - return html` - ${data.length === 1 ? "" : html`
${safeDump(result)}` - : error - ? html`
${safeDump(rest)}`} - `; - }); + for (const curPath of Object.keys(this.trace.trace)) { + // Include all child conditions too + if (active) { + if (!curPath.startsWith(childConditionsPrefix)) { + break; + } + } else if (curPath === this.selected.path) { + active = true; + } else { + continue; + } + + const data: ActionTraceStep[] = paths[curPath]; + + parts.push( + data.map((trace, idx) => { + const { + path, + timestamp, + result, + error, + changed_variables, + ...rest + } = trace as any; + + return html` + ${curPath === this.selected.path + ? "" + : html`
${safeDump(result)}` + : error + ? html`
${safeDump(rest)}`} + `; + }) + ); + } + + return parts; } private _renderSelectedConfig() {