diff --git a/src/data/action.ts b/src/data/action.ts index 5cc576f1ac..6dea0b308f 100644 --- a/src/data/action.ts +++ b/src/data/action.ts @@ -1,5 +1,6 @@ import { mdiAbTesting, + mdiApplicationVariableOutline, mdiArrowDecision, mdiCallSplit, mdiCodeBraces, @@ -30,4 +31,9 @@ export const ACTION_TYPES = { device_id: mdiDevices, stop: mdiHandBackRight, parallel: mdiShuffleDisabled, -}; + variables: mdiApplicationVariableOutline, +} as const; + +export const YAML_ONLY_ACTION_TYPES = new Set([ + "variables", +]); 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 a85feebf28..b66d7f4d3d 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -8,8 +8,8 @@ import { mdiPlay, mdiPlayCircleOutline, mdiRenameBox, - mdiStopCircleOutline, mdiSort, + mdiStopCircleOutline, } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; @@ -25,7 +25,7 @@ import "../../../../components/ha-card"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-icon-button"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { ACTION_TYPES } from "../../../../data/action"; +import { ACTION_TYPES, YAML_ONLY_ACTION_TYPES } from "../../../../data/action"; import { validateConfig } from "../../../../data/config"; import { EntityRegistryEntry, @@ -134,7 +134,9 @@ export default class HaAutomationActionRow extends LitElement { if (!changedProperties.has("action")) { return; } - this._uiModeAvailable = getType(this.action) !== undefined; + const type = getType(this.action); + this._uiModeAvailable = + type !== undefined && !YAML_ONLY_ACTION_TYPES.has(type as any); if (!this._uiModeAvailable && !this._yamlMode) { this._yamlMode = true; } diff --git a/src/translations/en.json b/src/translations/en.json index a038cb3cb4..a5e52f16ed 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2566,6 +2566,9 @@ }, "parallel": { "label": "Run in parallel" + }, + "variables": { + "label": "Define variables" } } }