diff --git a/src/data/automation.ts b/src/data/automation.ts index 506453a4f2..9e5c5310e6 100644 --- a/src/data/automation.ts +++ b/src/data/automation.ts @@ -15,16 +15,6 @@ import { migrateAutomationAction } from "./script"; export const AUTOMATION_DEFAULT_MODE: (typeof MODES)[number] = "single"; export const AUTOMATION_DEFAULT_MAX = 10; -declare global { - interface HASSDomEvents { - /** - * Dispatched to open the automation editor. - * Used by custom cards/panels to trigger the editor view. - */ - "show-automation-editor": ShowAutomationEditorParams; - } -} - export interface AutomationEntity extends HassEntityBase { attributes: HassEntityAttributeBase & { id?: string; diff --git a/src/state/automation-editor-mixin.ts b/src/state/automation-editor-mixin.ts index 458c02702c..6a833d703a 100644 --- a/src/state/automation-editor-mixin.ts +++ b/src/state/automation-editor-mixin.ts @@ -7,11 +7,21 @@ import { import type { Constructor } from "../types"; import type { HassBaseEl } from "./hass-base-mixin"; +declare global { + interface HASSDomEvents { + /** + * Dispatched to open the automation editor. + * Used by custom cards/panels to trigger the editor view. + */ + "hass-automation-editor": ShowAutomationEditorParams; + } +} + export default >(superClass: T) => class extends superClass { protected firstUpdated(changedProps: PropertyValues) { super.firstUpdated(changedProps); - this.addEventListener("show-automation-editor", (ev) => + this.addEventListener("hass-automation-editor", (ev) => this._handleShowAutomationEditor( ev as HASSDomEvent )