diff --git a/gallery/src/pages/automation/describe-action.ts b/gallery/src/pages/automation/describe-action.ts index d49527337c79..f15f8782f609 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 e6be959c9234..8cd67a2f4197 100644 --- a/src/components/trace/hat-trace-timeline.ts +++ b/src/components/trace/hat-trace-timeline.ts @@ -22,13 +22,8 @@ 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 { - floorsContext, - fullEntitiesContext, - labelsContext, -} from "../../data/context"; +import { 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 { @@ -206,7 +201,6 @@ class ActionRenderer { private hass: HomeAssistant, private entityReg: EntityRegistryEntry[], private labelReg: LabelRegistryEntry[], - private floorReg: FloorRegistryEntry[], private entries: TemplateResult[], private trace: AutomationTraceExtended, private logbookRenderer: LogbookRenderer, @@ -325,7 +319,6 @@ class ActionRenderer { this.hass, this.entityReg, this.labelReg, - this.floorReg, data, actionType ), @@ -493,13 +486,7 @@ class ActionRenderer { const name = repeatConfig.alias || - describeAction( - this.hass, - this.entityReg, - this.labelReg, - this.floorReg, - repeatConfig - ); + describeAction(this.hass, this.entityReg, this.labelReg, repeatConfig); this._renderEntry(repeatPath, name, undefined, disabled); @@ -597,7 +584,6 @@ class ActionRenderer { this.hass, this.entityReg, this.labelReg, - this.floorReg, sequenceConfig, "sequence" ), @@ -694,10 +680,6 @@ export class HaAutomationTracer extends LitElement { @consume({ context: labelsContext, subscribe: true }) _labelReg!: LabelRegistryEntry[]; - @state() - @consume({ context: floorsContext, subscribe: true }) - _floorReg!: FloorRegistryEntry[]; - protected render() { if (!this.trace) { return nothing; @@ -715,7 +697,6 @@ 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 75ebe5ae3d4f..35134384b8e2 100644 --- a/src/data/context.ts +++ b/src/data/context.ts @@ -2,7 +2,6 @@ import { createContext } from "@lit-labs/context"; import { HassConfig } from "home-assistant-js-websocket"; import { HomeAssistant } from "../types"; import { EntityRegistryEntry } from "./entity_registry"; -import { FloorRegistryEntry } from "./floor_registry"; import { LabelRegistryEntry } from "./label_registry"; export const connectionContext = @@ -28,6 +27,4 @@ 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 b623aba7dba5..75928b4bbeef 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -14,7 +14,6 @@ import { computeEntityRegistryName, entityRegistryById, } from "./entity_registry"; -import { FloorRegistryEntry } from "./floor_registry"; import { domainToName } from "./integration"; import { LabelRegistryEntry } from "./label_registry"; import { @@ -44,7 +43,6 @@ export const describeAction = ( hass: HomeAssistant, entityRegistry: EntityRegistryEntry[], labelRegistry: LabelRegistryEntry[], - floorRegistry: FloorRegistryEntry[], action: ActionTypes[T], actionType?: T, ignoreAlias = false @@ -54,7 +52,6 @@ export const describeAction = ( hass, entityRegistry, labelRegistry, - floorRegistry, action, actionType, ignoreAlias @@ -78,7 +75,6 @@ const tryDescribeAction = ( hass: HomeAssistant, entityRegistry: EntityRegistryEntry[], labelRegistry: LabelRegistryEntry[], - floorRegistry: FloorRegistryEntry[], action: ActionTypes[T], actionType?: T, ignoreAlias = false @@ -168,9 +164,7 @@ const tryDescribeAction = ( ); } } else if (key === "floor_id") { - const floor = floorRegistry.find( - (flr) => flr.floor_id === targetThing - ); + const floor = hass.floors[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 c31e5ccc8cc4..4a1cc05f8e76 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -43,13 +43,8 @@ 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 { - floorsContext, - fullEntitiesContext, - labelsContext, -} from "../../../../data/context"; +import { 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, @@ -158,10 +153,6 @@ export default class HaAutomationActionRow extends LitElement { @consume({ context: labelsContext, subscribe: true }) _labelReg!: LabelRegistryEntry[]; - @state() - @consume({ context: floorsContext, subscribe: true }) - _floorReg!: FloorRegistryEntry[]; - @state() private _warnings?: string[]; @state() private _uiModeAvailable = true; @@ -230,7 +221,6 @@ export default class HaAutomationActionRow extends LitElement { this.hass, this._entityReg, this._labelReg, - this._floorReg, this.action ) )} @@ -600,7 +590,6 @@ export default class HaAutomationActionRow extends LitElement { this.hass, this._entityReg, this._labelReg, - this._floorReg, this.action, undefined, true