diff --git a/src/components/ha-yaml-editor.ts b/src/components/ha-yaml-editor.ts
index 3666fb09ea..4d2f4c2c59 100644
--- a/src/components/ha-yaml-editor.ts
+++ b/src/components/ha-yaml-editor.ts
@@ -105,6 +105,10 @@ export class HaYamlEditor extends LitElement {
fireEvent(this, "value-changed", { value: parsed, isValid } as any);
}
+
+ get yaml() {
+ return this._editor?.value;
+ }
}
declare global {
diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts
index 72bfc2ced1..19fffa0298 100644
--- a/src/panels/config/automation/ha-automation-editor.ts
+++ b/src/panels/config/automation/ha-automation-editor.ts
@@ -1,5 +1,6 @@
import "@material/mwc-fab";
import {
+ mdiCheck,
mdiContentDuplicate,
mdiContentSave,
mdiDelete,
@@ -21,6 +22,7 @@ import {
property,
PropertyValues,
TemplateResult,
+ query,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
import { navigate } from "../../../common/navigate";
@@ -28,6 +30,8 @@ import "../../../components/ha-button-menu";
import "../../../components/ha-card";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
+import "../../../components/ha-yaml-editor";
+import type { HaYamlEditor } from "../../../components/ha-yaml-editor";
import {
AutomationConfig,
AutomationEntity,
@@ -89,6 +93,10 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
@internalProperty() private _entityId?: string;
+ @internalProperty() private _mode: "gui" | "yaml" = "gui";
+
+ @query("ha-yaml-editor", true) private _editor?: HaYamlEditor;
+
protected render(): TemplateResult {
const stateObj = this._entityId
? this.hass.states[this._entityId]
@@ -105,6 +113,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
corner="BOTTOM_START"
slot="toolbar-icon"
@action=${this._handleMenuAction}
+ activatable
>
- ${this.hass.localize(
- "ui.panel.config.automation.editor.modes.description",
- "documentation_link",
- html`
+ ${!this.narrow
+ ? html`
+ ${this._config.alias}
+ `
+ : ""}
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.introduction"
+ )}
+
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.modes.description",
+ "documentation_link",
+ html`${this.hass.localize(
+ "ui.panel.config.automation.editor.modes.documentation"
+ )}`
+ )}
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.triggers.introduction"
+ )}
+
+ ${this.hass.localize( + "ui.panel.config.automation.editor.conditions.introduction" + )} +
+ -+ ${this.hass.localize( + "ui.panel.config.automation.editor.actions.introduction" + )} +
+ -- ${this.hass.localize( - "ui.panel.config.automation.editor.triggers.introduction" - )} -
- - ${this.hass.localize( - "ui.panel.config.automation.editor.triggers.learn_more" - )} - - -- ${this.hass.localize( - "ui.panel.config.automation.editor.conditions.introduction" - )} -
- - ${this.hass.localize( - "ui.panel.config.automation.editor.conditions.learn_more" - )} - - -- ${this.hass.localize( - "ui.panel.config.automation.editor.actions.introduction" - )} -
- - ${this.hass.localize( - "ui.panel.config.automation.editor.actions.learn_more" - )} - - -+ ${this.hass.localize( + "ui.panel.config.script.editor.modes.description", + "documentation_link", + html`${this.hass.localize( + "ui.panel.config.script.editor.modes.documentation" + )}` + )} +
++ ${this.hass.localize( + "ui.panel.config.script.editor.sequence_sentence" )} - .errorMessage=${this.hass.localize( - "ui.panel.config.script.editor.id_already_exists" - )} - .invalid=${this._idError} - .value=${this._entityId} - @value-changed=${this._idChanged} - > -
- ${this.hass.localize( - "ui.panel.config.script.editor.modes.description", - "documentation_link", - html` + ${this.hass.localize( - "ui.panel.config.script.editor.modes.documentation" - )}` - )} -
-+ +
+