mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Add default config automation typings (#21657)
* typings * fixes * fixes * Update more typings
This commit is contained in:
parent
4913932c97
commit
2df097cd1b
@ -11,7 +11,6 @@ import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervis
|
||||
import type { ConditionWithShorthand } 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";
|
||||
@ -19,62 +18,67 @@ import { HaTemplateCondition } from "../../../../src/panels/config/automation/co
|
||||
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";
|
||||
import { HaAndCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-and";
|
||||
import { HaOrCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-or";
|
||||
import { HaNotCondition } from "../../../../src/panels/config/automation/condition/types/ha-automation-condition-not";
|
||||
|
||||
const SCHEMAS: { name: string; conditions: ConditionWithShorthand[] }[] = [
|
||||
{
|
||||
name: "State",
|
||||
conditions: [{ condition: "state", ...HaStateCondition.defaultConfig }],
|
||||
conditions: [{ ...HaStateCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Numeric State",
|
||||
conditions: [
|
||||
{ condition: "numeric_state", ...HaNumericStateCondition.defaultConfig },
|
||||
],
|
||||
conditions: [{ ...HaNumericStateCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Sun",
|
||||
conditions: [{ condition: "sun", ...HaSunCondition.defaultConfig }],
|
||||
conditions: [{ ...HaSunCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Zone",
|
||||
conditions: [{ condition: "zone", ...HaZoneCondition.defaultConfig }],
|
||||
conditions: [{ ...HaZoneCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Time",
|
||||
conditions: [{ condition: "time", ...HaTimeCondition.defaultConfig }],
|
||||
conditions: [{ ...HaTimeCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Template",
|
||||
conditions: [
|
||||
{ condition: "template", ...HaTemplateCondition.defaultConfig },
|
||||
],
|
||||
conditions: [{ ...HaTemplateCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Device",
|
||||
conditions: [{ condition: "device", ...HaDeviceCondition.defaultConfig }],
|
||||
conditions: [{ ...HaDeviceCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "And",
|
||||
conditions: [{ condition: "and", ...HaLogicalCondition.defaultConfig }],
|
||||
conditions: [{ ...HaAndCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Or",
|
||||
conditions: [{ condition: "or", ...HaLogicalCondition.defaultConfig }],
|
||||
conditions: [{ ...HaOrCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Not",
|
||||
conditions: [{ condition: "not", ...HaLogicalCondition.defaultConfig }],
|
||||
conditions: [{ ...HaNotCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Trigger",
|
||||
conditions: [{ condition: "trigger", ...HaTriggerCondition.defaultConfig }],
|
||||
conditions: [{ ...HaTriggerCondition.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Shorthand",
|
||||
conditions: [
|
||||
{ and: HaLogicalCondition.defaultConfig.conditions },
|
||||
{ or: HaLogicalCondition.defaultConfig.conditions },
|
||||
{ not: HaLogicalCondition.defaultConfig.conditions },
|
||||
{
|
||||
...HaAndCondition.defaultConfig,
|
||||
},
|
||||
{
|
||||
...HaOrCondition.defaultConfig,
|
||||
},
|
||||
{
|
||||
...HaNotCondition.defaultConfig,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -30,55 +30,48 @@ import { HaConversationTrigger } from "../../../../src/panels/config/automation/
|
||||
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||
{
|
||||
name: "State",
|
||||
triggers: [{ platform: "state", ...HaStateTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaStateTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "MQTT",
|
||||
triggers: [{ platform: "mqtt", ...HaMQTTTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaMQTTTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "GeoLocation",
|
||||
triggers: [
|
||||
{ platform: "geo_location", ...HaGeolocationTrigger.defaultConfig },
|
||||
],
|
||||
triggers: [{ ...HaGeolocationTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Home Assistant",
|
||||
triggers: [{ platform: "homeassistant", ...HaHassTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaHassTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Numeric State",
|
||||
triggers: [
|
||||
{ platform: "numeric_state", ...HaNumericStateTrigger.defaultConfig },
|
||||
],
|
||||
triggers: [{ ...HaNumericStateTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Sun",
|
||||
triggers: [{ platform: "sun", ...HaSunTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaSunTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Time Pattern",
|
||||
triggers: [
|
||||
{ platform: "time_pattern", ...HaTimePatternTrigger.defaultConfig },
|
||||
],
|
||||
triggers: [{ ...HaTimePatternTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Webhook",
|
||||
triggers: [{ platform: "webhook", ...HaWebhookTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaWebhookTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Persistent Notification",
|
||||
triggers: [
|
||||
{
|
||||
platform: "persistent_notification",
|
||||
...HaPersistentNotificationTrigger.defaultConfig,
|
||||
},
|
||||
],
|
||||
@ -86,37 +79,37 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||
|
||||
{
|
||||
name: "Zone",
|
||||
triggers: [{ platform: "zone", ...HaZoneTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaZoneTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Tag",
|
||||
triggers: [{ platform: "tag", ...HaTagTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaTagTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Time",
|
||||
triggers: [{ platform: "time", ...HaTimeTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaTimeTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Template",
|
||||
triggers: [{ platform: "template", ...HaTemplateTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaTemplateTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Event",
|
||||
triggers: [{ platform: "event", ...HaEventTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaEventTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Device Trigger",
|
||||
triggers: [{ platform: "device", ...HaDeviceTrigger.defaultConfig }],
|
||||
triggers: [{ ...HaDeviceTrigger.defaultConfig }],
|
||||
},
|
||||
{
|
||||
name: "Sentence",
|
||||
triggers: [
|
||||
{ platform: "conversation", ...HaConversationTrigger.defaultConfig },
|
||||
{ ...HaConversationTrigger.defaultConfig },
|
||||
{
|
||||
platform: "conversation",
|
||||
command: ["Turn on the lights", "Turn the lights on"],
|
||||
|
@ -86,7 +86,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
||||
this._unsubMql = undefined;
|
||||
}
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): ChooseAction {
|
||||
return { choose: [{ conditions: [], sequence: [] }] };
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ export class HaConditionAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ attribute: false }) public action!: Condition;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): Omit<Condition, "state" | "entity_id"> {
|
||||
return { condition: "state" };
|
||||
}
|
||||
|
||||
@ -87,13 +87,12 @@ export class HaConditionAction extends LitElement implements ActionElement {
|
||||
const elClass = customElements.get(
|
||||
`ha-automation-condition-${type}`
|
||||
) as CustomElementConstructor & {
|
||||
defaultConfig: Omit<Condition, "condition">;
|
||||
defaultConfig: Condition;
|
||||
};
|
||||
|
||||
if (type !== this.action.condition) {
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
condition: type,
|
||||
...elClass.defaultConfig,
|
||||
},
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ export class HaDelayAction extends LitElement implements ActionElement {
|
||||
|
||||
@state() private _timeData?: HaDurationData;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): DelayAction {
|
||||
return { delay: "" };
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ export class HaDeviceAction extends LitElement {
|
||||
|
||||
private _origAction?: DeviceAction;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): DeviceAction {
|
||||
return {
|
||||
device_id: "",
|
||||
domain: "",
|
||||
|
@ -21,7 +21,7 @@ export class HaIfAction extends LitElement implements ActionElement {
|
||||
|
||||
@state() private _showElse = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): IfAction {
|
||||
return {
|
||||
if: [],
|
||||
then: [],
|
||||
|
@ -18,7 +18,7 @@ export class HaParallelAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ attribute: false }) public action!: ParallelAction;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): ParallelAction {
|
||||
return {
|
||||
parallel: [],
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ type: Array }) public path?: ItemPath;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): RepeatAction {
|
||||
return { repeat: { count: 2, sequence: [] } };
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ export class HaSequenceAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ attribute: false }) public action!: SequenceAction;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): SequenceAction {
|
||||
return {
|
||||
sequence: [],
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ export class HaServiceAction extends LitElement implements ActionElement {
|
||||
}
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): ServiceAction {
|
||||
return { action: "", data: {} };
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ export class HaSetConversationResponseAction
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): SetConversationResponseAction {
|
||||
return { set_conversation_response: "" };
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export class HaStopAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): StopAction {
|
||||
return { stop: "" };
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ export class HaWaitForTriggerAction
|
||||
|
||||
@property({ attribute: false }) public path?: ItemPath;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): WaitForTriggerAction {
|
||||
return { wait_for_trigger: [] };
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ export class HaWaitAction extends LitElement implements ActionElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): WaitAction {
|
||||
return { wait_template: "", continue_on_timeout: true };
|
||||
}
|
||||
|
||||
|
@ -207,10 +207,9 @@ export default class HaAutomationCondition extends LitElement {
|
||||
const elClass = customElements.get(
|
||||
`ha-automation-condition-${condition}`
|
||||
) as CustomElementConstructor & {
|
||||
defaultConfig: Omit<Condition, "condition">;
|
||||
defaultConfig: Condition;
|
||||
};
|
||||
conditions = this.conditions.concat({
|
||||
condition: condition as any,
|
||||
...elClass.defaultConfig,
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import { HaLogicalCondition } from "./ha-automation-condition-logical";
|
||||
import { LogicalCondition } from "../../../../../data/automation";
|
||||
|
||||
@customElement("ha-automation-condition-and")
|
||||
export class HaAndCondition extends HaLogicalCondition {}
|
||||
export class HaAndCondition extends HaLogicalCondition {
|
||||
public static get defaultConfig(): LogicalCondition {
|
||||
return {
|
||||
condition: "and",
|
||||
conditions: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
|
@ -36,8 +36,9 @@ export class HaDeviceCondition extends LitElement {
|
||||
|
||||
private _origCondition?: DeviceCondition;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): DeviceCondition {
|
||||
return {
|
||||
condition: "device",
|
||||
device_id: "",
|
||||
domain: "",
|
||||
entity_id: "",
|
||||
|
@ -7,7 +7,10 @@ import "../ha-automation-condition";
|
||||
import type { ConditionElement } from "../ha-automation-condition-row";
|
||||
|
||||
@customElement("ha-automation-condition-logical")
|
||||
export class HaLogicalCondition extends LitElement implements ConditionElement {
|
||||
export abstract class HaLogicalCondition
|
||||
extends LitElement
|
||||
implements ConditionElement
|
||||
{
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property({ attribute: false }) public condition!: LogicalCondition;
|
||||
@ -16,12 +19,6 @@ export class HaLogicalCondition extends LitElement implements ConditionElement {
|
||||
|
||||
@property({ attribute: false }) public path?: ItemPath;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return {
|
||||
conditions: [],
|
||||
};
|
||||
}
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
<ha-automation-condition
|
||||
|
@ -1,8 +1,16 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import { HaLogicalCondition } from "./ha-automation-condition-logical";
|
||||
import { LogicalCondition } from "../../../../../data/automation";
|
||||
|
||||
@customElement("ha-automation-condition-not")
|
||||
export class HaNotCondition extends HaLogicalCondition {}
|
||||
export class HaNotCondition extends HaLogicalCondition {
|
||||
public static get defaultConfig(): LogicalCondition {
|
||||
return {
|
||||
condition: "not",
|
||||
conditions: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
|
@ -20,8 +20,9 @@ export default class HaNumericStateCondition extends LitElement {
|
||||
|
||||
@state() private _inputBelowIsEntity?: boolean;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): NumericStateCondition {
|
||||
return {
|
||||
condition: "numeric_state",
|
||||
entity_id: "",
|
||||
};
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
import { customElement } from "lit/decorators";
|
||||
import { HaLogicalCondition } from "./ha-automation-condition-logical";
|
||||
import { LogicalCondition } from "../../../../../data/automation";
|
||||
|
||||
@customElement("ha-automation-condition-or")
|
||||
export class HaOrCondition extends HaLogicalCondition {}
|
||||
export class HaOrCondition extends HaLogicalCondition {
|
||||
public static get defaultConfig(): LogicalCondition {
|
||||
return {
|
||||
condition: "or",
|
||||
conditions: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
|
@ -86,8 +86,8 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { entity_id: "", state: "" };
|
||||
public static get defaultConfig(): StateCondition {
|
||||
return { condition: "state", entity_id: "", state: "" };
|
||||
}
|
||||
|
||||
public shouldUpdate(changedProperties: PropertyValues) {
|
||||
|
@ -17,8 +17,8 @@ export class HaSunCondition extends LitElement implements ConditionElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return {};
|
||||
public static get defaultConfig(): SunCondition {
|
||||
return { condition: "sun" };
|
||||
}
|
||||
|
||||
private _schema = memoizeOne(
|
||||
|
@ -13,8 +13,8 @@ export class HaTemplateCondition extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { value_template: "" };
|
||||
public static get defaultConfig(): TemplateCondition {
|
||||
return { condition: "template", value_template: "" };
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -25,8 +25,8 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return {};
|
||||
public static get defaultConfig(): TimeCondition {
|
||||
return { condition: "time" };
|
||||
}
|
||||
|
||||
private _schema = memoizeOne(
|
||||
|
@ -27,8 +27,9 @@ export class HaTriggerCondition extends LitElement {
|
||||
|
||||
private _unsub?: UnsubscribeFunc;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): TriggerCondition {
|
||||
return {
|
||||
condition: "trigger",
|
||||
id: "",
|
||||
};
|
||||
}
|
||||
|
@ -21,8 +21,9 @@ export class HaZoneCondition extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): ZoneCondition {
|
||||
return {
|
||||
condition: "zone",
|
||||
entity_id: "",
|
||||
zone: "",
|
||||
};
|
||||
|
@ -143,10 +143,9 @@ export default class HaAutomationTrigger extends LitElement {
|
||||
const elClass = customElements.get(
|
||||
`ha-automation-trigger-${platform}`
|
||||
) as CustomElementConstructor & {
|
||||
defaultConfig: Omit<Trigger, "platform">;
|
||||
defaultConfig: Trigger;
|
||||
};
|
||||
triggers = this.triggers.concat({
|
||||
platform: platform as any,
|
||||
...elClass.defaultConfig,
|
||||
});
|
||||
}
|
||||
|
@ -69,10 +69,12 @@ export class HaCalendarTrigger extends LitElement implements TriggerElement {
|
||||
] as const
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): CalendarTrigger {
|
||||
return {
|
||||
platform: "calendar",
|
||||
entity_id: "",
|
||||
event: "start" as CalendarTrigger["event"],
|
||||
offset: 0,
|
||||
offset: "0",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ export class HaConversationTrigger
|
||||
|
||||
@query("#option_input", true) private _optionInput?: HaTextField;
|
||||
|
||||
public static get defaultConfig(): Omit<ConversationTrigger, "platform"> {
|
||||
return { command: "" };
|
||||
public static get defaultConfig(): ConversationTrigger {
|
||||
return { platform: "conversation", command: "" };
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -38,8 +38,9 @@ export class HaDeviceTrigger extends LitElement {
|
||||
|
||||
private _origTrigger?: DeviceTrigger;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): DeviceTrigger {
|
||||
return {
|
||||
platform: "device",
|
||||
device_id: "",
|
||||
domain: "",
|
||||
entity_id: "",
|
||||
|
@ -19,8 +19,8 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { event_type: "" };
|
||||
public static get defaultConfig(): EventTrigger {
|
||||
return { platform: "event", event_type: "" };
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -43,8 +43,9 @@ export class HaGeolocationTrigger extends LitElement {
|
||||
] as const
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): GeoLocationTrigger {
|
||||
return {
|
||||
platform: "geo_location",
|
||||
source: "",
|
||||
zone: "",
|
||||
event: "enter" as GeoLocationTrigger["event"],
|
||||
|
@ -41,8 +41,9 @@ export class HaHassTrigger extends LitElement {
|
||||
] as const
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): HassTrigger {
|
||||
return {
|
||||
platform: "homeassistant",
|
||||
event: "start" as HassTrigger["event"],
|
||||
};
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ export class HaMQTTTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { topic: "" };
|
||||
public static get defaultConfig(): MqttTrigger {
|
||||
return { platform: "mqtt", topic: "" };
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -237,8 +237,9 @@ export class HaNumericStateTrigger extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): NumericStateTrigger {
|
||||
return {
|
||||
platform: "numeric_state",
|
||||
entity_id: [],
|
||||
};
|
||||
}
|
||||
|
@ -70,8 +70,9 @@ export class HaPersistentNotificationTrigger
|
||||
] as const
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): PersistentNotificationTrigger {
|
||||
return {
|
||||
platform: "persistent_notification",
|
||||
update_type: [...DEFAULT_UPDATE_TYPES],
|
||||
notification_id: DEFAULT_NOTIFICATION_ID,
|
||||
};
|
||||
|
@ -48,8 +48,8 @@ export class HaStateTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { entity_id: [] };
|
||||
public static get defaultConfig(): StateTrigger {
|
||||
return { platform: "state", entity_id: [] };
|
||||
}
|
||||
|
||||
private _schema = memoizeOne(
|
||||
|
@ -43,8 +43,9 @@ export class HaSunTrigger extends LitElement implements TriggerElement {
|
||||
] as const
|
||||
);
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): SunTrigger {
|
||||
return {
|
||||
platform: "sun",
|
||||
event: "sunrise" as SunTrigger["event"],
|
||||
offset: 0,
|
||||
};
|
||||
|
@ -19,8 +19,8 @@ export class HaTagTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@state() private _tags?: Tag[];
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { tag_id: "" };
|
||||
public static get defaultConfig(): TagTrigger {
|
||||
return { platform: "tag", tag_id: "" };
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues) {
|
||||
|
@ -22,8 +22,8 @@ export class HaTemplateTrigger extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { value_template: "" };
|
||||
public static get defaultConfig(): TemplateTrigger {
|
||||
return { platform: "template", value_template: "" };
|
||||
}
|
||||
|
||||
public willUpdate(changedProperties: PropertyValues) {
|
||||
|
@ -19,8 +19,8 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@state() private _inputMode?: boolean;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return { at: "" };
|
||||
public static get defaultConfig(): TimeTrigger {
|
||||
return { platform: "time", at: "" };
|
||||
}
|
||||
|
||||
private _schema = memoizeOne(
|
||||
|
@ -21,8 +21,8 @@ export class HaTimePatternTrigger extends LitElement implements TriggerElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
return {};
|
||||
public static get defaultConfig(): TimePatternTrigger {
|
||||
return { platform: "time_pattern" };
|
||||
}
|
||||
|
||||
protected render() {
|
||||
|
@ -36,8 +36,9 @@ export class HaWebhookTrigger extends LitElement {
|
||||
|
||||
private _unsub?: UnsubscribeFunc;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): WebhookTrigger {
|
||||
return {
|
||||
platform: "webhook",
|
||||
allowed_methods: [...DEFAULT_METHODS],
|
||||
local_only: true,
|
||||
webhook_id: DEFAULT_WEBHOOK_ID,
|
||||
|
@ -23,8 +23,9 @@ export class HaZoneTrigger extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig() {
|
||||
public static get defaultConfig(): ZoneTrigger {
|
||||
return {
|
||||
platform: "zone",
|
||||
entity_id: "",
|
||||
zone: "",
|
||||
event: "enter" as ZoneTrigger["event"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user