From 05aa55bfb9ae3ba60a49e20f63eedee36b7ec478 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Sun, 16 Mar 2025 01:14:40 -0700 Subject: [PATCH] Fix describing device conditions in trace viewer (#24645) --- src/components/trace/ha-trace-path-details.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts index 2645703833..d37cd33637 100644 --- a/src/components/trace/ha-trace-path-details.ts +++ b/src/components/trace/ha-trace-path-details.ts @@ -1,4 +1,5 @@ import { dump } from "js-yaml"; +import { consume } from "@lit-labs/context"; import type { CSSResultGroup, TemplateResult } from "lit"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; @@ -19,6 +20,8 @@ import { traceTabStyles } from "./trace-tab-styles"; import type { HomeAssistant } from "../../types"; import type { NodeInfo } from "./hat-script-graph"; import { describeCondition } from "../../data/automation_i18n"; +import type { EntityRegistryEntry } from "../../data/entity_registry"; +import { fullEntitiesContext } from "../../data/context"; const TRACE_PATH_TABS = [ "step_config", @@ -45,6 +48,10 @@ export class HaTracePathDetails extends LitElement { @state() private _view: (typeof TRACE_PATH_TABS)[number] = "step_config"; + @state() + @consume({ context: fullEntitiesContext, subscribe: true }) + _entityReg!: EntityRegistryEntry[]; + protected render(): TemplateResult { return html`
@@ -166,7 +173,7 @@ export class HaTracePathDetails extends LitElement { ? html`[${describeCondition( currentDetail, this.hass, - currentDetail.alias + this._entityReg )}]
` : nothing} ${this.hass!.localize(