diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts index 410f05bd7b..75b4946f71 100644 --- a/src/components/trace/ha-trace-path-details.ts +++ b/src/components/trace/ha-trace-path-details.ts @@ -18,6 +18,7 @@ import "../../panels/logbook/ha-logbook-renderer"; import { traceTabStyles } from "./trace-tab-styles"; import type { HomeAssistant } from "../../types"; import type { NodeInfo } from "./hat-script-graph"; +import { describeCondition } from "../../data/automation_i18n"; const TRACE_PATH_TABS = [ "step_config", @@ -121,6 +122,19 @@ export class HaTracePathDetails extends LitElement { const data: ActionTraceStep[] = paths[curPath]; + // Extract details from this.selected.config child properties used to add 'alias' (to headline), describeCondition and 'entity_id' (to result) + const nestPath = curPath + .substring(this.selected.path.length + 1) + .split("/"); + let currentDetail = this.selected.config; + for (let i = 0; i < nestPath.length; i++) { + if ( + !["undefined", "string"].includes(typeof currentDetail[nestPath[i]]) + ) { + currentDetail = currentDetail[nestPath[i]]; + } + } + parts.push( data.map((trace, idx) => { const { path, timestamp, result, error, changed_variables, ...rest } = @@ -134,7 +148,9 @@ export class HaTracePathDetails extends LitElement { return html` ${curPath === this.selected.path - ? "" + ? currentDetail.alias + ? html`
${dump(rest)}`} + ${currentDetail.entity_id && + curPath + .substring(this.selected.path.length + 1) + .includes("entity_id") + ? html`
entity: ${currentDetail.entity_id}` + : nothing} `; }) );