Add show-automation-editor event for custom cards & panels (#26613)

* expose showAutomationEditor functionality in ha-panel-custom

* drop connectedCallback change (leftover from earlier test)

* enhance documentation for showAutomationEditor method

* Add automation editor mixin and event declaration for show-automation-editor
This commit is contained in:
Philipp Waller
2025-08-21 07:22:05 +02:00
committed by GitHub
parent e5585e13fe
commit feed58c33e
3 changed files with 43 additions and 0 deletions

View File

@@ -15,6 +15,16 @@ import { CONDITION_BUILDING_BLOCKS } from "./condition";
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;
@@ -546,3 +556,8 @@ export interface AutomationClipboard {
condition?: Condition;
action?: Action;
}
export interface ShowAutomationEditorParams {
data?: Partial<AutomationConfig>;
expanded?: boolean;
}