diff --git a/src/external_app/external_app_entrypoint.ts b/src/external_app/external_app_entrypoint.ts index 39176b652b2c..2f070044e2f1 100644 --- a/src/external_app/external_app_entrypoint.ts +++ b/src/external_app/external_app_entrypoint.ts @@ -7,6 +7,7 @@ This is the entry point for providing external app stuff from app entrypoint. import { fireEvent } from "../common/dom/fire_event"; import { mainWindow } from "../common/dom/get_main_window"; +import { showAutomationEditor } from "../data/automation"; import { HomeAssistantMain } from "../layouts/home-assistant-main"; import type { EMIncomingMessageCommands } from "./external_messaging"; @@ -79,6 +80,14 @@ const handleExternalMessage = ( success: true, result: null, }); + } else if (msg.command === "automation/editor/show") { + showAutomationEditor(msg.payload?.config); + bus.fireMessage({ + id: msg.id, + type: "result", + success: true, + result: null, + }); } else { return false; } diff --git a/src/external_app/external_messaging.ts b/src/external_app/external_messaging.ts index 94114f2fbf59..3021aba742d7 100644 --- a/src/external_app/external_messaging.ts +++ b/src/external_app/external_messaging.ts @@ -1,3 +1,5 @@ +import { AutomationConfig } from "../data/automation"; + const CALLBACK_EXTERNAL_BUS = "externalBus"; interface CommandInFlight { @@ -147,11 +149,21 @@ interface EMIncomingMessageShowSidebar { command: "sidebar/show"; } +interface EMIncomingMessageShowAutomationEditor { + id: number; + type: "command"; + command: "automation/editor/show"; + payload?: { + config?: Partial; + }; +} + export type EMIncomingMessageCommands = | EMIncomingMessageRestart | EMIncomingMessageShowNotifications | EMIncomingMessageToggleSidebar - | EMIncomingMessageShowSidebar; + | EMIncomingMessageShowSidebar + | EMIncomingMessageShowAutomationEditor; type EMIncomingMessage = | EMMessageResultSuccess