diff --git a/gallery/src/pages/automation/describe-action.ts b/gallery/src/pages/automation/describe-action.ts
index 9e23939871..57bd649d54 100644
--- a/gallery/src/pages/automation/describe-action.ts
+++ b/gallery/src/pages/automation/describe-action.ts
@@ -142,7 +142,7 @@ export class DemoAutomationDescribeAction extends LitElement {
${this._action
- ? describeAction(this.hass, [], [], this._action)
+ ? describeAction(this.hass, [], [], {}, this._action)
: ""}
html`
-
${describeAction(this.hass, [], [], conf as any)}
+
${describeAction(this.hass, [], [], {}, conf as any)}
${dump(conf)}
`
diff --git a/src/components/trace/hat-trace-timeline.ts b/src/components/trace/hat-trace-timeline.ts
index 8cd67a2f41..fafbff2fee 100644
--- a/src/components/trace/hat-trace-timeline.ts
+++ b/src/components/trace/hat-trace-timeline.ts
@@ -22,8 +22,13 @@ import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_tim
import { relativeTime } from "../../common/datetime/relative_time";
import { fireEvent } from "../../common/dom/fire_event";
import { toggleAttribute } from "../../common/dom/toggle_attribute";
-import { fullEntitiesContext, labelsContext } from "../../data/context";
+import {
+ floorsContext,
+ fullEntitiesContext,
+ labelsContext,
+} from "../../data/context";
import { EntityRegistryEntry } from "../../data/entity_registry";
+import { FloorRegistryEntry } from "../../data/floor_registry";
import { LabelRegistryEntry } from "../../data/label_registry";
import { LogbookEntry } from "../../data/logbook";
import {
@@ -201,6 +206,7 @@ class ActionRenderer {
private hass: HomeAssistant,
private entityReg: EntityRegistryEntry[],
private labelReg: LabelRegistryEntry[],
+ private floorReg: { [id: string]: FloorRegistryEntry },
private entries: TemplateResult[],
private trace: AutomationTraceExtended,
private logbookRenderer: LogbookRenderer,
@@ -319,6 +325,7 @@ class ActionRenderer {
this.hass,
this.entityReg,
this.labelReg,
+ this.floorReg,
data,
actionType
),
@@ -486,7 +493,13 @@ class ActionRenderer {
const name =
repeatConfig.alias ||
- describeAction(this.hass, this.entityReg, this.labelReg, repeatConfig);
+ describeAction(
+ this.hass,
+ this.entityReg,
+ this.labelReg,
+ this.floorReg,
+ repeatConfig
+ );
this._renderEntry(repeatPath, name, undefined, disabled);
@@ -584,6 +597,7 @@ class ActionRenderer {
this.hass,
this.entityReg,
this.labelReg,
+ this.floorReg,
sequenceConfig,
"sequence"
),
@@ -680,6 +694,10 @@ export class HaAutomationTracer extends LitElement {
@consume({ context: labelsContext, subscribe: true })
_labelReg!: LabelRegistryEntry[];
+ @state()
+ @consume({ context: floorsContext, subscribe: true })
+ _floorReg!: { [id: string]: FloorRegistryEntry };
+
protected render() {
if (!this.trace) {
return nothing;
@@ -697,6 +715,7 @@ export class HaAutomationTracer extends LitElement {
this.hass,
this._entityReg,
this._labelReg,
+ this._floorReg,
entries,
this.trace,
logbookRenderer,
diff --git a/src/data/context.ts b/src/data/context.ts
index 35134384b8..e424775f3c 100644
--- a/src/data/context.ts
+++ b/src/data/context.ts
@@ -27,4 +27,6 @@ export const panelsContext = createContext("panels");
export const fullEntitiesContext =
createContext("extendedEntities");
+export const floorsContext = createContext("floors");
+
export const labelsContext = createContext("labels");
diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts
index 75928b4bbe..15bac4372d 100644
--- a/src/data/script_i18n.ts
+++ b/src/data/script_i18n.ts
@@ -14,6 +14,7 @@ import {
computeEntityRegistryName,
entityRegistryById,
} from "./entity_registry";
+import { FloorRegistryEntry } from "./floor_registry";
import { domainToName } from "./integration";
import { LabelRegistryEntry } from "./label_registry";
import {
@@ -43,6 +44,7 @@ export const describeAction = (
hass: HomeAssistant,
entityRegistry: EntityRegistryEntry[],
labelRegistry: LabelRegistryEntry[],
+ floorRegistry: { [id: string]: FloorRegistryEntry },
action: ActionTypes[T],
actionType?: T,
ignoreAlias = false
@@ -52,6 +54,7 @@ export const describeAction = (
hass,
entityRegistry,
labelRegistry,
+ floorRegistry,
action,
actionType,
ignoreAlias
@@ -75,6 +78,7 @@ const tryDescribeAction = (
hass: HomeAssistant,
entityRegistry: EntityRegistryEntry[],
labelRegistry: LabelRegistryEntry[],
+ floorRegistry: { [id: string]: FloorRegistryEntry },
action: ActionTypes[T],
actionType?: T,
ignoreAlias = false
@@ -164,7 +168,7 @@ const tryDescribeAction = (
);
}
} else if (key === "floor_id") {
- const floor = hass.floors[targetThing] ?? undefined;
+ const floor = floorRegistry[targetThing] ?? undefined;
if (floor?.name) {
targets.push(floor.name);
} else {
diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts
index 93da62bf9d..ce4813b29f 100644
--- a/src/panels/config/automation/action/ha-automation-action-row.ts
+++ b/src/panels/config/automation/action/ha-automation-action-row.ts
@@ -43,8 +43,13 @@ import type { HaYamlEditor } from "../../../../components/ha-yaml-editor";
import { ACTION_ICONS, YAML_ONLY_ACTION_TYPES } from "../../../../data/action";
import { AutomationClipboard } from "../../../../data/automation";
import { validateConfig } from "../../../../data/config";
-import { fullEntitiesContext, labelsContext } from "../../../../data/context";
+import {
+ floorsContext,
+ fullEntitiesContext,
+ labelsContext,
+} from "../../../../data/context";
import { EntityRegistryEntry } from "../../../../data/entity_registry";
+import { FloorRegistryEntry } from "../../../../data/floor_registry";
import { LabelRegistryEntry } from "../../../../data/label_registry";
import {
Action,
@@ -154,6 +159,10 @@ export default class HaAutomationActionRow extends LitElement {
@consume({ context: labelsContext, subscribe: true })
_labelReg!: LabelRegistryEntry[];
+ @state()
+ @consume({ context: floorsContext, subscribe: true })
+ _floorReg!: { [id: string]: FloorRegistryEntry };
+
@state() private _warnings?: string[];
@state() private _uiModeAvailable = true;
@@ -222,6 +231,7 @@ export default class HaAutomationActionRow extends LitElement {
this.hass,
this._entityReg,
this._labelReg,
+ this._floorReg,
this.action
)
)}
@@ -593,6 +603,7 @@ export default class HaAutomationActionRow extends LitElement {
this.hass,
this._entityReg,
this._labelReg,
+ this._floorReg,
this.action,
undefined,
true
diff --git a/src/state/context-mixin.ts b/src/state/context-mixin.ts
index d0ad7266f5..4d5120e673 100644
--- a/src/state/context-mixin.ts
+++ b/src/state/context-mixin.ts
@@ -5,6 +5,7 @@ import {
connectionContext,
devicesContext,
entitiesContext,
+ floorsContext,
localeContext,
localizeContext,
panelsContext,
@@ -87,6 +88,10 @@ export const contextMixin = >(
context: panelsContext,
initialValue: this.hass ? this.hass.panels : this._pendingHass.panels,
}),
+ floors: new ContextProvider(this, {
+ context: floorsContext,
+ initialValue: this.hass ? this.hass.floors : this._pendingHass.floors,
+ }),
};
protected hassConnected() {