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 9644803d3d..f28278e134 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -195,7 +195,7 @@ export default class HaAutomationActionRow extends LitElement { - You can still edit your config in yaml. + You can still edit your config in YAML. ` : ""} ${yamlMode diff --git a/src/panels/config/automation/action/types/ha-automation-action-service.ts b/src/panels/config/automation/action/types/ha-automation-action-service.ts index 55c80675eb..cc5df3e369 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-service.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-service.ts @@ -19,12 +19,12 @@ import type { HaYamlEditor } from "../../../../../components/ha-yaml-editor"; import { ServiceAction } from "../../../../../data/script"; import type { PolymerChangedEvent } from "../../../../../polymer-types"; import type { HomeAssistant } from "../../../../../types"; -import { EntityId } from "../../../../lovelace/common/structs/is-entity-id"; +import { EntityIdOrAll } from "../../../../lovelace/common/structs/is-entity-id"; import { ActionElement, handleChangeEvent } from "../ha-automation-action-row"; const actionStruct = object({ service: optional(string()), - entity_id: optional(EntityId), + entity_id: optional(EntityIdOrAll), data: optional(any()), }); diff --git a/src/panels/lovelace/common/structs/is-entity-id.ts b/src/panels/lovelace/common/structs/is-entity-id.ts index 26931ab19c..f88e466880 100644 --- a/src/panels/lovelace/common/structs/is-entity-id.ts +++ b/src/panels/lovelace/common/structs/is-entity-id.ts @@ -7,7 +7,7 @@ const isEntityId = (value: unknown, context: StructContext): StructResult => { if (!value.includes(".")) { return [ context.fail({ - type: "entity id should be in the format 'domain.entity'", + type: "Entity ID should be in the format 'domain.entity'", }), ]; } @@ -15,3 +15,16 @@ const isEntityId = (value: unknown, context: StructContext): StructResult => { }; export const EntityId = struct("entity-id", isEntityId); + +const isEntityIdOrAll = ( + value: unknown, + context: StructContext +): StructResult => { + if (typeof value === "string" && value === "all") { + return true; + } + + return isEntityId(value, context); +}; + +export const EntityIdOrAll = struct("entity-id-all", isEntityIdOrAll);