mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix YAML validation for automation action service call enabling/disabling (#14536)
fixes undefined
This commit is contained in:
parent
076ddb71b6
commit
20dff9d25d
@ -1,22 +1,13 @@
|
||||
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { any, assert, object, optional, string } from "superstruct";
|
||||
import { assert } from "superstruct";
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import { hasTemplate } from "../../../../../common/string/has-template";
|
||||
import { entityIdOrAll } from "../../../../../common/structs/is-entity-id";
|
||||
import "../../../../../components/ha-service-control";
|
||||
import { ServiceAction } from "../../../../../data/script";
|
||||
import { ServiceAction, serviceActionStruct } from "../../../../../data/script";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import { ActionElement } from "../ha-automation-action-row";
|
||||
|
||||
const actionStruct = object({
|
||||
alias: optional(string()),
|
||||
service: optional(string()),
|
||||
entity_id: optional(entityIdOrAll()),
|
||||
target: optional(any()),
|
||||
data: optional(any()),
|
||||
});
|
||||
|
||||
@customElement("ha-automation-action-service")
|
||||
export class HaServiceAction extends LitElement implements ActionElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
@ -38,7 +29,7 @@ export class HaServiceAction extends LitElement implements ActionElement {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
assert(this.action, actionStruct);
|
||||
assert(this.action, serviceActionStruct);
|
||||
} catch (err: any) {
|
||||
fireEvent(this, "ui-mode-not-available", err);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user