mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Add automation editor to gallery (#10392)
This commit is contained in:
parent
bf0d102c86
commit
dd11fb1b99
91
gallery/src/demos/demo-automation-editor-action.ts
Normal file
91
gallery/src/demos/demo-automation-editor-action.ts
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/* eslint-disable lit/no-template-arrow */
|
||||||
|
import { LitElement, TemplateResult, html } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
import "../components/demo-black-white-row";
|
||||||
|
import { mockEntityRegistry } from "../../../demo/src/stubs/entity_registry";
|
||||||
|
import { mockDeviceRegistry } from "../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockAreaRegistry } from "../../../demo/src/stubs/area_registry";
|
||||||
|
import { mockHassioSupervisor } from "../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import "../../../src/panels/config/automation/action/ha-automation-action";
|
||||||
|
import { HaChooseAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-choose";
|
||||||
|
import { HaDelayAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-delay";
|
||||||
|
import { HaDeviceAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-device_id";
|
||||||
|
import { HaEventAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-event";
|
||||||
|
import { HaRepeatAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-repeat";
|
||||||
|
import { HaSceneAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-scene";
|
||||||
|
import { HaServiceAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-service";
|
||||||
|
import { HaWaitForTriggerAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
|
||||||
|
import { HaWaitAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
|
||||||
|
import { Action } from "../../../src/data/script";
|
||||||
|
import { HaConditionAction } from "../../../src/panels/config/automation/action/types/ha-automation-action-condition";
|
||||||
|
|
||||||
|
const SCHEMAS: { name: string; actions: Action[] }[] = [
|
||||||
|
{ name: "Event", actions: [HaEventAction.defaultConfig] },
|
||||||
|
{ name: "Device", actions: [HaDeviceAction.defaultConfig] },
|
||||||
|
{ name: "Service", actions: [HaServiceAction.defaultConfig] },
|
||||||
|
{ name: "Condition", actions: [HaConditionAction.defaultConfig] },
|
||||||
|
{ name: "Delay", actions: [HaDelayAction.defaultConfig] },
|
||||||
|
{ name: "Scene", actions: [HaSceneAction.defaultConfig] },
|
||||||
|
{ name: "Wait", actions: [HaWaitAction.defaultConfig] },
|
||||||
|
{ name: "WaitForTrigger", actions: [HaWaitForTriggerAction.defaultConfig] },
|
||||||
|
{ name: "Repeat", actions: [HaRepeatAction.defaultConfig] },
|
||||||
|
{ name: "Choose", actions: [HaChooseAction.defaultConfig] },
|
||||||
|
{ name: "Variables", actions: [{ variables: { hello: "1" } }] },
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-automation-editor-action")
|
||||||
|
class DemoHaAutomationEditorAction extends LitElement {
|
||||||
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
private data: any = SCHEMAS.map((info) => info.actions);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
const hass = provideHass(this);
|
||||||
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
|
mockEntityRegistry(hass);
|
||||||
|
mockDeviceRegistry(hass);
|
||||||
|
mockAreaRegistry(hass);
|
||||||
|
mockHassioSupervisor(hass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
const valueChanged = (ev) => {
|
||||||
|
const sampleIdx = ev.target.sampleIdx;
|
||||||
|
this.data[sampleIdx] = ev.detail.value;
|
||||||
|
this.requestUpdate();
|
||||||
|
};
|
||||||
|
return html`
|
||||||
|
${SCHEMAS.map(
|
||||||
|
(info, sampleIdx) => html`
|
||||||
|
<demo-black-white-row
|
||||||
|
.title=${info.name}
|
||||||
|
.value=${this.data[sampleIdx]}
|
||||||
|
>
|
||||||
|
${["light", "dark"].map(
|
||||||
|
(slot) =>
|
||||||
|
html`
|
||||||
|
<ha-automation-action
|
||||||
|
slot=${slot}
|
||||||
|
.hass=${this.hass}
|
||||||
|
.actions=${this.data[sampleIdx]}
|
||||||
|
.sampleIdx=${sampleIdx}
|
||||||
|
@value-changed=${valueChanged}
|
||||||
|
></ha-automation-action>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</demo-black-white-row>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-ha-automation-editor-action": DemoHaAutomationEditorAction;
|
||||||
|
}
|
||||||
|
}
|
127
gallery/src/demos/demo-automation-editor-condition.ts
Normal file
127
gallery/src/demos/demo-automation-editor-condition.ts
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/* eslint-disable lit/no-template-arrow */
|
||||||
|
import { LitElement, TemplateResult, html } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
import "../components/demo-black-white-row";
|
||||||
|
import { mockEntityRegistry } from "../../../demo/src/stubs/entity_registry";
|
||||||
|
import { mockDeviceRegistry } from "../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockAreaRegistry } from "../../../demo/src/stubs/area_registry";
|
||||||
|
import { mockHassioSupervisor } from "../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import type { Condition } from "../../../src/data/automation";
|
||||||
|
import "../../../src/panels/config/automation/condition/ha-automation-condition";
|
||||||
|
import { HaDeviceCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-device";
|
||||||
|
import { HaLogicalCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-logical";
|
||||||
|
import HaNumericStateCondition from "../../../src/panels/config/automation/condition/types/ha-automation-condition-numeric_state";
|
||||||
|
import { HaStateCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-state";
|
||||||
|
import { HaSunCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-sun";
|
||||||
|
import { HaTemplateCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-template";
|
||||||
|
import { HaTimeCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-time";
|
||||||
|
import { HaTriggerCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-trigger";
|
||||||
|
import { HaZoneCondition } from "../../../src/panels/config/automation/condition/types/ha-automation-condition-zone";
|
||||||
|
|
||||||
|
const SCHEMAS: { name: string; conditions: Condition[] }[] = [
|
||||||
|
{
|
||||||
|
name: "State",
|
||||||
|
conditions: [{ condition: "state", ...HaStateCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Numeric State",
|
||||||
|
conditions: [
|
||||||
|
{ condition: "numeric_state", ...HaNumericStateCondition.defaultConfig },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Sun",
|
||||||
|
conditions: [{ condition: "sun", ...HaSunCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Zone",
|
||||||
|
conditions: [{ condition: "zone", ...HaZoneCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Time",
|
||||||
|
conditions: [{ condition: "time", ...HaTimeCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Template",
|
||||||
|
conditions: [
|
||||||
|
{ condition: "template", ...HaTemplateCondition.defaultConfig },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Device",
|
||||||
|
conditions: [{ condition: "device", ...HaDeviceCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "And",
|
||||||
|
conditions: [{ condition: "and", ...HaLogicalCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Or",
|
||||||
|
conditions: [{ condition: "or", ...HaLogicalCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Not",
|
||||||
|
conditions: [{ condition: "not", ...HaLogicalCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Trigger",
|
||||||
|
conditions: [{ condition: "trigger", ...HaTriggerCondition.defaultConfig }],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-automation-editor-condition")
|
||||||
|
class DemoHaAutomationEditorCondition extends LitElement {
|
||||||
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
private data: any = SCHEMAS.map((info) => info.conditions);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
const hass = provideHass(this);
|
||||||
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
|
mockEntityRegistry(hass);
|
||||||
|
mockDeviceRegistry(hass);
|
||||||
|
mockAreaRegistry(hass);
|
||||||
|
mockHassioSupervisor(hass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
const valueChanged = (ev) => {
|
||||||
|
const sampleIdx = ev.target.sampleIdx;
|
||||||
|
this.data[sampleIdx] = ev.detail.value;
|
||||||
|
this.requestUpdate();
|
||||||
|
};
|
||||||
|
return html`
|
||||||
|
${SCHEMAS.map(
|
||||||
|
(info, sampleIdx) => html`
|
||||||
|
<demo-black-white-row
|
||||||
|
.title=${info.name}
|
||||||
|
.value=${this.data[sampleIdx]}
|
||||||
|
>
|
||||||
|
${["light", "dark"].map(
|
||||||
|
(slot) =>
|
||||||
|
html`
|
||||||
|
<ha-automation-condition
|
||||||
|
slot=${slot}
|
||||||
|
.hass=${this.hass}
|
||||||
|
.conditions=${this.data[sampleIdx]}
|
||||||
|
.sampleIdx=${sampleIdx}
|
||||||
|
@value-changed=${valueChanged}
|
||||||
|
></ha-automation-condition>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</demo-black-white-row>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-ha-automation-editor-condition": DemoHaAutomationEditorCondition;
|
||||||
|
}
|
||||||
|
}
|
159
gallery/src/demos/demo-automation-editor-trigger.ts
Normal file
159
gallery/src/demos/demo-automation-editor-trigger.ts
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/* eslint-disable lit/no-template-arrow */
|
||||||
|
import { LitElement, TemplateResult, html } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
import "../components/demo-black-white-row";
|
||||||
|
import { mockEntityRegistry } from "../../../demo/src/stubs/entity_registry";
|
||||||
|
import { mockDeviceRegistry } from "../../../demo/src/stubs/device_registry";
|
||||||
|
import { mockAreaRegistry } from "../../../demo/src/stubs/area_registry";
|
||||||
|
import { mockHassioSupervisor } from "../../../demo/src/stubs/hassio_supervisor";
|
||||||
|
import type { Trigger } from "../../../src/data/automation";
|
||||||
|
import { HaGeolocationTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-geo_location";
|
||||||
|
import { HaEventTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-event";
|
||||||
|
import { HaHassTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-homeassistant";
|
||||||
|
import { HaNumericStateTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state";
|
||||||
|
import { HaSunTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-sun";
|
||||||
|
import { HaTagTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-tag";
|
||||||
|
import { HaTemplateTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-template";
|
||||||
|
import { HaTimeTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time";
|
||||||
|
import { HaTimePatternTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time_pattern";
|
||||||
|
import { HaWebhookTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-webhook";
|
||||||
|
import { HaZoneTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-zone";
|
||||||
|
import { HaDeviceTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-device";
|
||||||
|
import { HaStateTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-state";
|
||||||
|
import { HaMQTTTrigger } from "../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
||||||
|
import "../../../src/panels/config/automation/trigger/ha-automation-trigger";
|
||||||
|
|
||||||
|
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||||
|
{
|
||||||
|
name: "State",
|
||||||
|
triggers: [{ platform: "state", ...HaStateTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "MQTT",
|
||||||
|
triggers: [{ platform: "mqtt", ...HaMQTTTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "GeoLocation",
|
||||||
|
triggers: [
|
||||||
|
{ platform: "geo_location", ...HaGeolocationTrigger.defaultConfig },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Home Assistant",
|
||||||
|
triggers: [{ platform: "homeassistant", ...HaHassTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Numeric State",
|
||||||
|
triggers: [
|
||||||
|
{ platform: "numeric_state", ...HaNumericStateTrigger.defaultConfig },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Sun",
|
||||||
|
triggers: [{ platform: "sun", ...HaSunTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Time Pattern",
|
||||||
|
triggers: [
|
||||||
|
{ platform: "time_pattern", ...HaTimePatternTrigger.defaultConfig },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Webhook",
|
||||||
|
triggers: [{ platform: "webhook", ...HaWebhookTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Zone",
|
||||||
|
triggers: [{ platform: "zone", ...HaZoneTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Tag",
|
||||||
|
triggers: [{ platform: "tag", ...HaTagTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Time",
|
||||||
|
triggers: [{ platform: "time", ...HaTimeTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Template",
|
||||||
|
triggers: [{ platform: "template", ...HaTemplateTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Event",
|
||||||
|
triggers: [{ platform: "event", ...HaEventTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Device Trigger",
|
||||||
|
triggers: [{ platform: "device", ...HaDeviceTrigger.defaultConfig }],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-automation-editor-trigger")
|
||||||
|
class DemoHaAutomationEditorTrigger extends LitElement {
|
||||||
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
private data: any = SCHEMAS.map((info) => info.triggers);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
const hass = provideHass(this);
|
||||||
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
|
mockEntityRegistry(hass);
|
||||||
|
mockDeviceRegistry(hass);
|
||||||
|
mockAreaRegistry(hass);
|
||||||
|
mockHassioSupervisor(hass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
const valueChanged = (ev) => {
|
||||||
|
const sampleIdx = ev.target.sampleIdx;
|
||||||
|
this.data[sampleIdx] = ev.detail.value;
|
||||||
|
this.requestUpdate();
|
||||||
|
};
|
||||||
|
return html`
|
||||||
|
${SCHEMAS.map(
|
||||||
|
(info, sampleIdx) => html`
|
||||||
|
<demo-black-white-row
|
||||||
|
.title=${info.name}
|
||||||
|
.value=${this.data[sampleIdx]}
|
||||||
|
>
|
||||||
|
${["light", "dark"].map(
|
||||||
|
(slot) =>
|
||||||
|
html`
|
||||||
|
<ha-automation-trigger
|
||||||
|
slot=${slot}
|
||||||
|
.hass=${this.hass}
|
||||||
|
.triggers=${this.data[sampleIdx]}
|
||||||
|
.sampleIdx=${sampleIdx}
|
||||||
|
@value-changed=${valueChanged}
|
||||||
|
></ha-automation-trigger>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</demo-black-white-row>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-ha-automation-editor-trigger": DemoHaAutomationEditorTrigger;
|
||||||
|
}
|
||||||
|
}
|
@ -194,10 +194,10 @@ export interface NumericStateCondition extends BaseCondition {
|
|||||||
|
|
||||||
export interface SunCondition extends BaseCondition {
|
export interface SunCondition extends BaseCondition {
|
||||||
condition: "sun";
|
condition: "sun";
|
||||||
after_offset: number;
|
after_offset?: number;
|
||||||
before_offset: number;
|
before_offset?: number;
|
||||||
after: "sunrise" | "sunset";
|
after?: "sunrise" | "sunset";
|
||||||
before: "sunrise" | "sunset";
|
before?: "sunrise" | "sunset";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ZoneCondition extends BaseCondition {
|
export interface ZoneCondition extends BaseCondition {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { html, LitElement } from "lit";
|
import { html, LitElement } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||||
import { LogicalCondition } from "../../../../../data/automation";
|
import { Condition, LogicalCondition } from "../../../../../data/automation";
|
||||||
import { HomeAssistant } from "../../../../../types";
|
import { HomeAssistant } from "../../../../../types";
|
||||||
import "../ha-automation-condition";
|
import "../ha-automation-condition";
|
||||||
import { ConditionElement } from "../ha-automation-condition-row";
|
import { ConditionElement } from "../ha-automation-condition-row";
|
||||||
|
import { HaStateCondition } from "./ha-automation-condition-state";
|
||||||
|
|
||||||
@customElement("ha-automation-condition-logical")
|
@customElement("ha-automation-condition-logical")
|
||||||
export class HaLogicalCondition extends LitElement implements ConditionElement {
|
export class HaLogicalCondition extends LitElement implements ConditionElement {
|
||||||
@ -13,7 +14,14 @@ export class HaLogicalCondition extends LitElement implements ConditionElement {
|
|||||||
@property() public condition!: LogicalCondition;
|
@property() public condition!: LogicalCondition;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { conditions: [{ condition: "state" }] };
|
return {
|
||||||
|
conditions: [
|
||||||
|
{
|
||||||
|
condition: "state",
|
||||||
|
...HaStateCondition.defaultConfig,
|
||||||
|
},
|
||||||
|
] as Condition[],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
|
@ -10,7 +10,7 @@ import { handleChangeEvent } from "../ha-automation-trigger-row";
|
|||||||
const includeDomains = ["zone"];
|
const includeDomains = ["zone"];
|
||||||
|
|
||||||
@customElement("ha-automation-trigger-geo_location")
|
@customElement("ha-automation-trigger-geo_location")
|
||||||
export default class HaGeolocationTrigger extends LitElement {
|
export class HaGeolocationTrigger extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property({ attribute: false }) public trigger!: GeoLocationTrigger;
|
@property({ attribute: false }) public trigger!: GeoLocationTrigger;
|
||||||
@ -19,7 +19,7 @@ export default class HaGeolocationTrigger extends LitElement {
|
|||||||
return {
|
return {
|
||||||
source: "",
|
source: "",
|
||||||
zone: "",
|
zone: "",
|
||||||
event: "enter",
|
event: "enter" as GeoLocationTrigger["event"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@ import "../../../../../components/ha-formfield";
|
|||||||
import "../../../../../components/ha-radio";
|
import "../../../../../components/ha-radio";
|
||||||
|
|
||||||
@customElement("ha-automation-trigger-homeassistant")
|
@customElement("ha-automation-trigger-homeassistant")
|
||||||
export default class HaHassTrigger extends LitElement {
|
export class HaHassTrigger extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property({ attribute: false }) public trigger!: HassTrigger;
|
@property({ attribute: false }) public trigger!: HassTrigger;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {
|
return {
|
||||||
event: "start",
|
event: "start" as HassTrigger["event"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import { handleChangeEvent } from "../ha-automation-trigger-row";
|
|||||||
import "../../../../../components/ha-duration-input";
|
import "../../../../../components/ha-duration-input";
|
||||||
|
|
||||||
@customElement("ha-automation-trigger-numeric_state")
|
@customElement("ha-automation-trigger-numeric_state")
|
||||||
export default class HaNumericStateTrigger extends LitElement {
|
export class HaNumericStateTrigger extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public trigger!: NumericStateTrigger;
|
@property() public trigger!: NumericStateTrigger;
|
||||||
|
@ -20,7 +20,8 @@ export class HaSunTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {
|
return {
|
||||||
event: "sunrise",
|
event: "sunrise" as SunTrigger["event"],
|
||||||
|
offset: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
return {
|
return {
|
||||||
entity_id: "",
|
entity_id: "",
|
||||||
zone: "",
|
zone: "",
|
||||||
event: "enter",
|
event: "enter" as ZoneTrigger["event"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user