mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Show non-editable automations in UI (#13900)
This commit is contained in:
parent
9f658c10c3
commit
0b76183acd
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html } from "lit";
|
import { LitElement, TemplateResult, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
@ -47,6 +47,8 @@ const SCHEMAS: { name: string; actions: Action[] }[] = [
|
|||||||
class DemoHaAutomationEditorAction extends LitElement {
|
class DemoHaAutomationEditorAction extends LitElement {
|
||||||
@state() private hass!: HomeAssistant;
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@state() private _disabled = false;
|
||||||
|
|
||||||
private data: any = SCHEMAS.map((info) => info.actions);
|
private data: any = SCHEMAS.map((info) => info.actions);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -67,6 +69,15 @@ class DemoHaAutomationEditorAction extends LitElement {
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
return html`
|
return html`
|
||||||
|
<div class="options">
|
||||||
|
<ha-formfield label="Disabled">
|
||||||
|
<ha-switch
|
||||||
|
.name=${"disabled"}
|
||||||
|
.checked=${this._disabled}
|
||||||
|
@change=${this._handleOptionChange}
|
||||||
|
></ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
</div>
|
||||||
${SCHEMAS.map(
|
${SCHEMAS.map(
|
||||||
(info, sampleIdx) => html`
|
(info, sampleIdx) => html`
|
||||||
<demo-black-white-row
|
<demo-black-white-row
|
||||||
@ -81,6 +92,7 @@ class DemoHaAutomationEditorAction extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.actions=${this.data[sampleIdx]}
|
.actions=${this.data[sampleIdx]}
|
||||||
.sampleIdx=${sampleIdx}
|
.sampleIdx=${sampleIdx}
|
||||||
|
.disabled=${this._disabled}
|
||||||
@value-changed=${valueChanged}
|
@value-changed=${valueChanged}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
`
|
`
|
||||||
@ -90,6 +102,20 @@ class DemoHaAutomationEditorAction extends LitElement {
|
|||||||
)}
|
)}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _handleOptionChange(ev) {
|
||||||
|
this[`_${ev.target.name}`] = ev.target.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
.options {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 16px auto;
|
||||||
|
}
|
||||||
|
.options ha-formfield {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html } from "lit";
|
import { LitElement, TemplateResult, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
@ -83,6 +83,8 @@ const SCHEMAS: { name: string; conditions: ConditionWithShorthand[] }[] = [
|
|||||||
class DemoHaAutomationEditorCondition extends LitElement {
|
class DemoHaAutomationEditorCondition extends LitElement {
|
||||||
@state() private hass!: HomeAssistant;
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@state() private _disabled = false;
|
||||||
|
|
||||||
private data: any = SCHEMAS.map((info) => info.conditions);
|
private data: any = SCHEMAS.map((info) => info.conditions);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -103,6 +105,15 @@ class DemoHaAutomationEditorCondition extends LitElement {
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
return html`
|
return html`
|
||||||
|
<div class="options">
|
||||||
|
<ha-formfield label="Disabled">
|
||||||
|
<ha-switch
|
||||||
|
.name=${"disabled"}
|
||||||
|
.checked=${this._disabled}
|
||||||
|
@change=${this._handleOptionChange}
|
||||||
|
></ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
</div>
|
||||||
${SCHEMAS.map(
|
${SCHEMAS.map(
|
||||||
(info, sampleIdx) => html`
|
(info, sampleIdx) => html`
|
||||||
<demo-black-white-row
|
<demo-black-white-row
|
||||||
@ -117,6 +128,7 @@ class DemoHaAutomationEditorCondition extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.conditions=${this.data[sampleIdx]}
|
.conditions=${this.data[sampleIdx]}
|
||||||
.sampleIdx=${sampleIdx}
|
.sampleIdx=${sampleIdx}
|
||||||
|
.disabled=${this._disabled}
|
||||||
@value-changed=${valueChanged}
|
@value-changed=${valueChanged}
|
||||||
></ha-automation-condition>
|
></ha-automation-condition>
|
||||||
`
|
`
|
||||||
@ -126,6 +138,20 @@ class DemoHaAutomationEditorCondition extends LitElement {
|
|||||||
)}
|
)}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _handleOptionChange(ev) {
|
||||||
|
this[`_${ev.target.name}`] = ev.target.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
.options {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 16px auto;
|
||||||
|
}
|
||||||
|
.options ha-formfield {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html } from "lit";
|
import { LitElement, TemplateResult, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
@ -107,6 +107,8 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
|||||||
class DemoHaAutomationEditorTrigger extends LitElement {
|
class DemoHaAutomationEditorTrigger extends LitElement {
|
||||||
@state() private hass!: HomeAssistant;
|
@state() private hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@state() private _disabled = false;
|
||||||
|
|
||||||
private data: any = SCHEMAS.map((info) => info.triggers);
|
private data: any = SCHEMAS.map((info) => info.triggers);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -127,6 +129,15 @@ class DemoHaAutomationEditorTrigger extends LitElement {
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
return html`
|
return html`
|
||||||
|
<div class="options">
|
||||||
|
<ha-formfield label="Disabled">
|
||||||
|
<ha-switch
|
||||||
|
.name=${"disabled"}
|
||||||
|
.checked=${this._disabled}
|
||||||
|
@change=${this._handleOptionChange}
|
||||||
|
></ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
</div>
|
||||||
${SCHEMAS.map(
|
${SCHEMAS.map(
|
||||||
(info, sampleIdx) => html`
|
(info, sampleIdx) => html`
|
||||||
<demo-black-white-row
|
<demo-black-white-row
|
||||||
@ -141,6 +152,7 @@ class DemoHaAutomationEditorTrigger extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.triggers=${this.data[sampleIdx]}
|
.triggers=${this.data[sampleIdx]}
|
||||||
.sampleIdx=${sampleIdx}
|
.sampleIdx=${sampleIdx}
|
||||||
|
.disabled=${this._disabled}
|
||||||
@value-changed=${valueChanged}
|
@value-changed=${valueChanged}
|
||||||
></ha-automation-trigger>
|
></ha-automation-trigger>
|
||||||
`
|
`
|
||||||
@ -150,6 +162,20 @@ class DemoHaAutomationEditorTrigger extends LitElement {
|
|||||||
)}
|
)}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _handleOptionChange(ev) {
|
||||||
|
this[`_${ev.target.name}`] = ev.target.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
.options {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 16px auto;
|
||||||
|
}
|
||||||
|
.options ha-formfield {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -312,6 +312,7 @@ export class HaEntityPicker extends LitElement {
|
|||||||
.filteredItems=${this._states}
|
.filteredItems=${this._states}
|
||||||
.renderer=${rowRenderer}
|
.renderer=${rowRenderer}
|
||||||
.required=${this.required}
|
.required=${this.required}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@opened-changed=${this._openedChanged}
|
@opened-changed=${this._openedChanged}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
@filter-changed=${this._filterChanged}
|
@filter-changed=${this._filterChanged}
|
||||||
|
@ -55,12 +55,14 @@ export class HaServiceControl extends LitElement {
|
|||||||
data?: Record<string, any>;
|
data?: Record<string, any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@state() private _value!: this["value"];
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ reflect: true, type: Boolean }) public narrow!: boolean;
|
@property({ reflect: true, type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@property({ type: Boolean }) public showAdvanced?: boolean;
|
@property({ type: Boolean }) public showAdvanced?: boolean;
|
||||||
|
|
||||||
|
@state() private _value!: this["value"];
|
||||||
|
|
||||||
@state() private _checkedKeys = new Set();
|
@state() private _checkedKeys = new Set();
|
||||||
|
|
||||||
@state() private _manifest?: IntegrationManifest;
|
@state() private _manifest?: IntegrationManifest;
|
||||||
@ -227,6 +229,7 @@ export class HaServiceControl extends LitElement {
|
|||||||
return html`<ha-service-picker
|
return html`<ha-service-picker
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${this._value?.service}
|
.value=${this._value?.service}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._serviceChanged}
|
@value-changed=${this._serviceChanged}
|
||||||
></ha-service-picker>
|
></ha-service-picker>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
@ -273,6 +276,7 @@ export class HaServiceControl extends LitElement {
|
|||||||
.selector=${serviceData.target
|
.selector=${serviceData.target
|
||||||
? { target: serviceData.target }
|
? { target: serviceData.target }
|
||||||
: { target: {} }}
|
: { target: {} }}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._targetChanged}
|
@value-changed=${this._targetChanged}
|
||||||
.value=${this._value?.target}
|
.value=${this._value?.target}
|
||||||
></ha-selector
|
></ha-selector
|
||||||
@ -280,6 +284,7 @@ export class HaServiceControl extends LitElement {
|
|||||||
: entityId
|
: entityId
|
||||||
? html`<ha-entity-picker
|
? html`<ha-entity-picker
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.value=${this._value?.data?.entity_id}
|
.value=${this._value?.data?.entity_id}
|
||||||
.label=${entityId.description}
|
.label=${entityId.description}
|
||||||
@value-changed=${this._entityPicked}
|
@value-changed=${this._entityPicked}
|
||||||
@ -291,6 +296,7 @@ export class HaServiceControl extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.label=${this.hass.localize("ui.components.service-control.data")}
|
.label=${this.hass.localize("ui.components.service-control.data")}
|
||||||
.name=${"data"}
|
.name=${"data"}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
.defaultValue=${this._value?.data}
|
.defaultValue=${this._value?.data}
|
||||||
@value-changed=${this._dataChanged}
|
@value-changed=${this._dataChanged}
|
||||||
></ha-yaml-editor>`
|
></ha-yaml-editor>`
|
||||||
@ -311,16 +317,18 @@ export class HaServiceControl extends LitElement {
|
|||||||
.checked=${this._checkedKeys.has(dataField.key) ||
|
.checked=${this._checkedKeys.has(dataField.key) ||
|
||||||
(this._value?.data &&
|
(this._value?.data &&
|
||||||
this._value.data[dataField.key] !== undefined)}
|
this._value.data[dataField.key] !== undefined)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._checkboxChanged}
|
@change=${this._checkboxChanged}
|
||||||
slot="prefix"
|
slot="prefix"
|
||||||
></ha-checkbox>`}
|
></ha-checkbox>`}
|
||||||
<span slot="heading">${dataField.name || dataField.key}</span>
|
<span slot="heading">${dataField.name || dataField.key}</span>
|
||||||
<span slot="description">${dataField?.description}</span>
|
<span slot="description">${dataField?.description}</span>
|
||||||
<ha-selector
|
<ha-selector
|
||||||
.disabled=${showOptional &&
|
.disabled=${this.disabled ||
|
||||||
!this._checkedKeys.has(dataField.key) &&
|
(showOptional &&
|
||||||
(!this._value?.data ||
|
!this._checkedKeys.has(dataField.key) &&
|
||||||
this._value.data[dataField.key] === undefined)}
|
(!this._value?.data ||
|
||||||
|
this._value.data[dataField.key] === undefined))}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.selector=${dataField.selector}
|
.selector=${dataField.selector}
|
||||||
.key=${dataField.key}
|
.key=${dataField.key}
|
||||||
|
@ -20,6 +20,8 @@ const rowRenderer: ComboBoxLitRenderer<{ service: string; name: string }> = (
|
|||||||
class HaServicePicker extends LitElement {
|
class HaServicePicker extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public value?: string;
|
@property() public value?: string;
|
||||||
|
|
||||||
@state() private _filter?: string;
|
@state() private _filter?: string;
|
||||||
@ -35,6 +37,7 @@ class HaServicePicker extends LitElement {
|
|||||||
this._filter
|
this._filter
|
||||||
)}
|
)}
|
||||||
.value=${this.value}
|
.value=${this.value}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.renderer=${rowRenderer}
|
.renderer=${rowRenderer}
|
||||||
item-value-path="service"
|
item-value-path="service"
|
||||||
item-label-path="name"
|
item-label-path="name"
|
||||||
|
@ -311,9 +311,18 @@ export const deleteAutomation = (hass: HomeAssistant, id: string) =>
|
|||||||
|
|
||||||
let inititialAutomationEditorData: Partial<AutomationConfig> | undefined;
|
let inititialAutomationEditorData: Partial<AutomationConfig> | undefined;
|
||||||
|
|
||||||
export const getAutomationConfig = (hass: HomeAssistant, id: string) =>
|
export const fetchAutomationFileConfig = (hass: HomeAssistant, id: string) =>
|
||||||
hass.callApi<AutomationConfig>("GET", `config/automation/config/${id}`);
|
hass.callApi<AutomationConfig>("GET", `config/automation/config/${id}`);
|
||||||
|
|
||||||
|
export const getAutomationStateConfig = (
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entity_id: string
|
||||||
|
) =>
|
||||||
|
hass.callWS<{ config: AutomationConfig }>({
|
||||||
|
type: "automation/config",
|
||||||
|
entity_id,
|
||||||
|
});
|
||||||
|
|
||||||
export const saveAutomationConfig = (
|
export const saveAutomationConfig = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
id: string,
|
id: string,
|
||||||
|
@ -100,6 +100,8 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public hideMenu = false;
|
@property({ type: Boolean }) public hideMenu = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -179,7 +181,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
<ha-svg-icon slot="graphic" .path=${mdiPlay}></ha-svg-icon>
|
<ha-svg-icon slot="graphic" .path=${mdiPlay}></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.rename"
|
"ui.panel.config.automation.editor.actions.rename"
|
||||||
)}
|
)}
|
||||||
@ -188,7 +190,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
.path=${mdiRenameBox}
|
.path=${mdiRenameBox}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.duplicate"
|
"ui.panel.config.automation.editor.actions.duplicate"
|
||||||
)}
|
)}
|
||||||
@ -234,7 +236,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
|
|
||||||
<li divider role="separator"></li>
|
<li divider role="separator"></li>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.action.enabled === false
|
${this.action.enabled === false
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.enable"
|
"ui.panel.config.automation.editor.actions.enable"
|
||||||
@ -249,7 +251,11 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
: mdiStopCircleOutline}
|
: mdiStopCircleOutline}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item class="warning" graphic="icon">
|
<mwc-list-item
|
||||||
|
class="warning"
|
||||||
|
graphic="icon"
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.delete"
|
"ui.panel.config.automation.editor.actions.delete"
|
||||||
)}
|
)}
|
||||||
@ -302,6 +308,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.action}
|
.defaultValue=${this.action}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
@value-changed=${this._onYamlChange}
|
@value-changed=${this._onYamlChange}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
`
|
`
|
||||||
@ -312,6 +319,7 @@ export default class HaAutomationActionRow extends LitElement {
|
|||||||
action: this.action,
|
action: this.action,
|
||||||
narrow: this.narrow,
|
narrow: this.narrow,
|
||||||
reOrderMode: this.reOrderMode,
|
reOrderMode: this.reOrderMode,
|
||||||
|
disabled: this.disabled,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
`}
|
`}
|
||||||
|
@ -44,6 +44,8 @@ export default class HaAutomationAction extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public actions!: Action[];
|
@property() public actions!: Action[];
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -65,6 +67,7 @@ export default class HaAutomationAction extends LitElement {
|
|||||||
.index=${idx}
|
.index=${idx}
|
||||||
.action=${action}
|
.action=${action}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.hideMenu=${this.reOrderMode}
|
.hideMenu=${this.reOrderMode}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
@duplicate=${this._duplicateAction}
|
@duplicate=${this._duplicateAction}
|
||||||
@ -102,10 +105,15 @@ export default class HaAutomationAction extends LitElement {
|
|||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ha-button-menu fixed @action=${this._addAction}>
|
<ha-button-menu
|
||||||
|
fixed
|
||||||
|
@action=${this._addAction}
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
<mwc-button
|
<mwc-button
|
||||||
slot="trigger"
|
slot="trigger"
|
||||||
outlined
|
outlined
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.add"
|
"ui.panel.config.automation.editor.actions.add"
|
||||||
)}
|
)}
|
||||||
|
@ -13,6 +13,8 @@ const includeDomains = ["scene"];
|
|||||||
export class HaSceneAction extends LitElement implements ActionElement {
|
export class HaSceneAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public action!: SceneAction;
|
@property() public action!: SceneAction;
|
||||||
|
|
||||||
public static get defaultConfig(): SceneAction {
|
public static get defaultConfig(): SceneAction {
|
||||||
@ -41,6 +43,7 @@ export class HaSceneAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.activate_scene.scene"
|
"ui.panel.config.automation.editor.actions.type.activate_scene.scene"
|
||||||
)}
|
)}
|
||||||
.value=${scene}
|
.value=${scene}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._entityPicked}
|
@value-changed=${this._entityPicked}
|
||||||
.includeDomains=${includeDomains}
|
.includeDomains=${includeDomains}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
|
@ -14,6 +14,8 @@ import { ActionElement } from "../ha-automation-action-row";
|
|||||||
export class HaChooseAction extends LitElement implements ActionElement {
|
export class HaChooseAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public action!: ChooseAction;
|
@property() public action!: ChooseAction;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -32,6 +34,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
(option, idx) => html`<ha-card>
|
(option, idx) => html`<ha-card>
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
.idx=${idx}
|
.idx=${idx}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@click=${this._removeOption}
|
@click=${this._removeOption}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.choose.remove_option"
|
"ui.panel.config.automation.editor.actions.type.choose.remove_option"
|
||||||
@ -54,6 +57,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-condition
|
<ha-automation-condition
|
||||||
.conditions=${option.conditions}
|
.conditions=${option.conditions}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.idx=${idx}
|
.idx=${idx}
|
||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
@ -66,6 +70,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${option.sequence || []}
|
.actions=${option.sequence || []}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.idx=${idx}
|
.idx=${idx}
|
||||||
@value-changed=${this._actionChanged}
|
@value-changed=${this._actionChanged}
|
||||||
@ -78,6 +83,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.choose.add_option"
|
"ui.panel.config.automation.editor.actions.type.choose.add_option"
|
||||||
)}
|
)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@click=${this._addOption}
|
@click=${this._addOption}
|
||||||
>
|
>
|
||||||
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
|
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
|
||||||
@ -92,12 +98,17 @@ export class HaChooseAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${action.default || []}
|
.actions=${action.default || []}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._defaultChanged}
|
@value-changed=${this._defaultChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
`
|
`
|
||||||
: html` <div class="link-button-row">
|
: html`<div class="link-button-row">
|
||||||
<button class="link" @click=${this._addDefault}>
|
<button
|
||||||
|
class="link"
|
||||||
|
@click=${this._addDefault}
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.choose.add_default"
|
"ui.panel.config.automation.editor.actions.type.choose.add_default"
|
||||||
)}
|
)}
|
||||||
|
@ -16,6 +16,8 @@ import type { ActionElement } from "../ha-automation-action-row";
|
|||||||
export class HaConditionAction extends LitElement implements ActionElement {
|
export class HaConditionAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public action!: Condition;
|
@property() public action!: Condition;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
@ -29,6 +31,7 @@ export class HaConditionAction extends LitElement implements ActionElement {
|
|||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.conditions.type_select"
|
"ui.panel.config.automation.editor.conditions.type_select"
|
||||||
)}
|
)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.value=${this.action.condition}
|
.value=${this.action.condition}
|
||||||
naturalMenuWidth
|
naturalMenuWidth
|
||||||
@selected=${this._typeChanged}
|
@selected=${this._typeChanged}
|
||||||
@ -43,6 +46,7 @@ export class HaConditionAction extends LitElement implements ActionElement {
|
|||||||
</ha-select>
|
</ha-select>
|
||||||
<ha-automation-condition-editor
|
<ha-automation-condition-editor
|
||||||
.condition=${this.action}
|
.condition=${this.action}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
></ha-automation-condition-editor>
|
></ha-automation-condition-editor>
|
||||||
|
@ -13,6 +13,8 @@ import { createDurationData } from "../../../../../common/datetime/create_durati
|
|||||||
export class HaDelayAction extends LitElement implements ActionElement {
|
export class HaDelayAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public action!: DelayAction;
|
@property({ attribute: false }) public action!: DelayAction;
|
||||||
|
|
||||||
@state() private _timeData?: HaDurationData;
|
@state() private _timeData?: HaDurationData;
|
||||||
@ -43,6 +45,7 @@ export class HaDelayAction extends LitElement implements ActionElement {
|
|||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
`ui.panel.config.automation.editor.actions.type.delay.delay`
|
`ui.panel.config.automation.editor.actions.type.delay.delay`
|
||||||
)}
|
)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.data=${this._timeData}
|
.data=${this._timeData}
|
||||||
enableMillisecond
|
enableMillisecond
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
|
@ -17,6 +17,8 @@ import { HomeAssistant } from "../../../../../types";
|
|||||||
export class HaDeviceAction extends LitElement {
|
export class HaDeviceAction extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Object }) public action!: DeviceAction;
|
@property({ type: Object }) public action!: DeviceAction;
|
||||||
|
|
||||||
@state() private _deviceId?: string;
|
@state() private _deviceId?: string;
|
||||||
@ -51,6 +53,7 @@ export class HaDeviceAction extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-device-picker
|
<ha-device-picker
|
||||||
.value=${deviceId}
|
.value=${deviceId}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._devicePicked}
|
@value-changed=${this._devicePicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
label=${this.hass.localize(
|
label=${this.hass.localize(
|
||||||
@ -60,6 +63,7 @@ export class HaDeviceAction extends LitElement {
|
|||||||
<ha-device-action-picker
|
<ha-device-action-picker
|
||||||
.value=${this.action}
|
.value=${this.action}
|
||||||
.deviceId=${deviceId}
|
.deviceId=${deviceId}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._deviceActionPicked}
|
@value-changed=${this._deviceActionPicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
label=${this.hass.localize(
|
label=${this.hass.localize(
|
||||||
@ -72,6 +76,7 @@ export class HaDeviceAction extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._extraFieldsData(this.action, this._capabilities)}
|
.data=${this._extraFieldsData(this.action, this._capabilities)}
|
||||||
.schema=${this._capabilities.extra_fields}
|
.schema=${this._capabilities.extra_fields}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
||||||
this.hass.localize
|
this.hass.localize
|
||||||
)}
|
)}
|
||||||
|
@ -14,6 +14,8 @@ import { ActionElement, handleChangeEvent } from "../ha-automation-action-row";
|
|||||||
export class HaEventAction extends LitElement implements ActionElement {
|
export class HaEventAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property() public action!: EventAction;
|
@property() public action!: EventAction;
|
||||||
|
|
||||||
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;
|
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;
|
||||||
@ -45,6 +47,7 @@ export class HaEventAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.event.event"
|
"ui.panel.config.automation.editor.actions.type.event.event"
|
||||||
)}
|
)}
|
||||||
.value=${event}
|
.value=${event}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._eventChanged}
|
@change=${this._eventChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
@ -53,6 +56,7 @@ export class HaEventAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.event.event_data"
|
"ui.panel.config.automation.editor.actions.type.event.event_data"
|
||||||
)}
|
)}
|
||||||
.name=${"event_data"}
|
.name=${"event_data"}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
.defaultValue=${event_data}
|
.defaultValue=${event_data}
|
||||||
@value-changed=${this._dataChanged}
|
@value-changed=${this._dataChanged}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
|
@ -13,6 +13,8 @@ import type { ActionElement } from "../ha-automation-action-row";
|
|||||||
export class HaIfAction extends LitElement implements ActionElement {
|
export class HaIfAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public action!: IfAction;
|
@property({ attribute: false }) public action!: IfAction;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -38,6 +40,7 @@ export class HaIfAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-condition
|
<ha-automation-condition
|
||||||
.conditions=${action.if}
|
.conditions=${action.if}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._ifChanged}
|
@value-changed=${this._ifChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-condition>
|
></ha-automation-condition>
|
||||||
@ -50,6 +53,7 @@ export class HaIfAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${action.then}
|
.actions=${action.then}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._thenChanged}
|
@value-changed=${this._thenChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
@ -63,12 +67,17 @@ export class HaIfAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${action.else || []}
|
.actions=${action.else || []}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._elseChanged}
|
@value-changed=${this._elseChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
`
|
`
|
||||||
: html` <div class="link-button-row">
|
: html` <div class="link-button-row">
|
||||||
<button class="link" @click=${this._addElse}>
|
<button
|
||||||
|
class="link"
|
||||||
|
@click=${this._addElse}
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.if.add_else"
|
"ui.panel.config.automation.editor.actions.type.if.add_else"
|
||||||
)}
|
)}
|
||||||
|
@ -12,6 +12,8 @@ import type { ActionElement } from "../ha-automation-action-row";
|
|||||||
export class HaParallelAction extends LitElement implements ActionElement {
|
export class HaParallelAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public action!: ParallelAction;
|
@property({ attribute: false }) public action!: ParallelAction;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -29,6 +31,7 @@ export class HaParallelAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${action.parallel}
|
.actions=${action.parallel}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._actionsChanged}
|
@value-changed=${this._actionsChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
|
@ -12,6 +12,8 @@ import { ActionElement } from "../ha-automation-action-row";
|
|||||||
export class HaPlayMediaAction extends LitElement implements ActionElement {
|
export class HaPlayMediaAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public action!: PlayMediaAction;
|
@property({ attribute: false }) public action!: PlayMediaAction;
|
||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
@ -38,6 +40,7 @@ export class HaPlayMediaAction extends LitElement implements ActionElement {
|
|||||||
return html`
|
return html`
|
||||||
<ha-selector-media
|
<ha-selector-media
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.value=${this._getSelectorValue(this.action)}
|
.value=${this._getSelectorValue(this.action)}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-selector-media>
|
></ha-selector-media>
|
||||||
|
@ -23,6 +23,8 @@ const getType = (action) => OPTIONS.find((option) => option in action);
|
|||||||
export class HaRepeatAction extends LitElement implements ActionElement {
|
export class HaRepeatAction extends LitElement implements ActionElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public action!: RepeatAction;
|
@property({ attribute: false }) public action!: RepeatAction;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -42,6 +44,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.repeat.type_select"
|
"ui.panel.config.automation.editor.actions.type.repeat.type_select"
|
||||||
)}
|
)}
|
||||||
.value=${type}
|
.value=${type}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@selected=${this._typeChanged}
|
@selected=${this._typeChanged}
|
||||||
>
|
>
|
||||||
${OPTIONS.map(
|
${OPTIONS.map(
|
||||||
@ -63,6 +66,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
|||||||
)}
|
)}
|
||||||
name="count"
|
name="count"
|
||||||
.value=${(action as CountRepeat).count || "0"}
|
.value=${(action as CountRepeat).count || "0"}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._countChanged}
|
@change=${this._countChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
`
|
`
|
||||||
@ -75,6 +79,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-condition
|
<ha-automation-condition
|
||||||
.conditions=${(action as WhileRepeat).while || []}
|
.conditions=${(action as WhileRepeat).while || []}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
></ha-automation-condition>`
|
></ha-automation-condition>`
|
||||||
: type === "until"
|
: type === "until"
|
||||||
@ -86,6 +91,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-condition
|
<ha-automation-condition
|
||||||
.conditions=${(action as UntilRepeat).until || []}
|
.conditions=${(action as UntilRepeat).until || []}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
></ha-automation-condition>`
|
></ha-automation-condition>`
|
||||||
: ""}
|
: ""}
|
||||||
@ -98,6 +104,7 @@ export class HaRepeatAction extends LitElement implements ActionElement {
|
|||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
.actions=${action.sequence}
|
.actions=${action.sequence}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._actionChanged}
|
@value-changed=${this._actionChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
|
@ -23,6 +23,8 @@ export class HaServiceAction extends LitElement implements ActionElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public action!: ServiceAction;
|
@property({ attribute: false }) public action!: ServiceAction;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public narrow = false;
|
@property({ type: Boolean }) public narrow = false;
|
||||||
|
|
||||||
@state() private _action!: ServiceAction;
|
@state() private _action!: ServiceAction;
|
||||||
@ -66,6 +68,7 @@ export class HaServiceAction extends LitElement implements ActionElement {
|
|||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${this._action}
|
.value=${this._action}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.showAdvanced=${this.hass.userData?.showAdvanced}
|
.showAdvanced=${this.hass.userData?.showAdvanced}
|
||||||
@value-changed=${this._actionChanged}
|
@value-changed=${this._actionChanged}
|
||||||
></ha-service-control>
|
></ha-service-control>
|
||||||
|
@ -12,6 +12,8 @@ export class HaStopAction extends LitElement implements ActionElement {
|
|||||||
|
|
||||||
@property() public action!: StopAction;
|
@property() public action!: StopAction;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { stop: "" };
|
return { stop: "" };
|
||||||
}
|
}
|
||||||
@ -25,14 +27,17 @@ export class HaStopAction extends LitElement implements ActionElement {
|
|||||||
"ui.panel.config.automation.editor.actions.type.stop.stop"
|
"ui.panel.config.automation.editor.actions.type.stop.stop"
|
||||||
)}
|
)}
|
||||||
.value=${stop}
|
.value=${stop}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._stopChanged}
|
@change=${this._stopChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-formfield
|
<ha-formfield
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.stop.error"
|
"ui.panel.config.automation.editor.actions.type.stop.error"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ha-switch
|
<ha-switch
|
||||||
|
.disabled=${this.disabled}
|
||||||
.checked=${error ?? false}
|
.checked=${error ?? false}
|
||||||
@change=${this._errorChanged}
|
@change=${this._errorChanged}
|
||||||
></ha-switch>
|
></ha-switch>
|
||||||
|
@ -21,6 +21,8 @@ export class HaWaitForTriggerAction
|
|||||||
|
|
||||||
@property({ attribute: false }) public action!: WaitForTriggerAction;
|
@property({ attribute: false }) public action!: WaitForTriggerAction;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { wait_for_trigger: [] };
|
return { wait_for_trigger: [] };
|
||||||
}
|
}
|
||||||
@ -34,22 +36,26 @@ export class HaWaitForTriggerAction
|
|||||||
"ui.panel.config.automation.editor.actions.type.wait_for_trigger.timeout"
|
"ui.panel.config.automation.editor.actions.type.wait_for_trigger.timeout"
|
||||||
)}
|
)}
|
||||||
.data=${timeData}
|
.data=${timeData}
|
||||||
|
.disabled=${this.disabled}
|
||||||
enableMillisecond
|
enableMillisecond
|
||||||
@value-changed=${this._timeoutChanged}
|
@value-changed=${this._timeoutChanged}
|
||||||
></ha-duration-input>
|
></ha-duration-input>
|
||||||
<ha-formfield
|
<ha-formfield
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.type.wait_for_trigger.continue_timeout"
|
"ui.panel.config.automation.editor.actions.type.wait_for_trigger.continue_timeout"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ha-switch
|
<ha-switch
|
||||||
.checked=${this.action.continue_on_timeout ?? true}
|
.checked=${this.action.continue_on_timeout ?? true}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._continueChanged}
|
@change=${this._continueChanged}
|
||||||
></ha-switch>
|
></ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
<ha-automation-trigger
|
<ha-automation-trigger
|
||||||
.triggers=${ensureArray(this.action.wait_for_trigger)}
|
.triggers=${ensureArray(this.action.wait_for_trigger)}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.name=${"wait_for_trigger"}
|
.name=${"wait_for_trigger"}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-automation-trigger>
|
></ha-automation-trigger>
|
||||||
|
@ -32,6 +32,8 @@ export class HaWaitAction extends LitElement implements ActionElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public action!: WaitAction;
|
@property({ attribute: false }) public action!: WaitAction;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { wait_template: "", continue_on_timeout: true };
|
return { wait_template: "", continue_on_timeout: true };
|
||||||
}
|
}
|
||||||
@ -42,6 +44,7 @@ export class HaWaitAction extends LitElement implements ActionElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this.action}
|
.data=${this.action}
|
||||||
.schema=${SCHEMA}
|
.schema=${SCHEMA}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
`;
|
`;
|
||||||
|
@ -27,6 +27,8 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
|
|
||||||
@property() public isWide!: boolean;
|
@property() public isWide!: boolean;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ reflect: true, type: Boolean }) public narrow!: boolean;
|
@property({ reflect: true, type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@property() public config!: BlueprintAutomationConfig;
|
@property() public config!: BlueprintAutomationConfig;
|
||||||
@ -50,6 +52,14 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
protected render() {
|
protected render() {
|
||||||
const blueprint = this._blueprint;
|
const blueprint = this._blueprint;
|
||||||
return html`
|
return html`
|
||||||
|
${this.disabled
|
||||||
|
? html`<ha-alert alert-type="warning">
|
||||||
|
${this.hass.localize("ui.panel.config.automation.editor.read_only")}
|
||||||
|
<mwc-button slot="action" @click=${this._duplicate}>
|
||||||
|
${this.hass.localize("ui.panel.config.automation.editor.migrate")}
|
||||||
|
</mwc-button>
|
||||||
|
</ha-alert>`
|
||||||
|
: ""}
|
||||||
${this.stateObj?.state === "off"
|
${this.stateObj?.state === "off"
|
||||||
? html`
|
? html`
|
||||||
<ha-alert alert-type="info">
|
<ha-alert alert-type="info">
|
||||||
@ -85,6 +95,7 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
)}
|
)}
|
||||||
.blueprints=${this._blueprints}
|
.blueprints=${this._blueprints}
|
||||||
.value=${this.config.use_blueprint.path}
|
.value=${this.config.use_blueprint.path}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._blueprintChanged}
|
@value-changed=${this._blueprintChanged}
|
||||||
></ha-blueprint-picker>
|
></ha-blueprint-picker>
|
||||||
`
|
`
|
||||||
@ -126,6 +137,7 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
.value=${(this.config.use_blueprint.input &&
|
.value=${(this.config.use_blueprint.input &&
|
||||||
this.config.use_blueprint.input[key]) ??
|
this.config.use_blueprint.input[key]) ??
|
||||||
value?.default}
|
value?.default}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._inputChanged}
|
@value-changed=${this._inputChanged}
|
||||||
></ha-selector>`
|
></ha-selector>`
|
||||||
: html`<ha-textfield
|
: html`<ha-textfield
|
||||||
@ -134,6 +146,7 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
.value=${(this.config.use_blueprint.input &&
|
.value=${(this.config.use_blueprint.input &&
|
||||||
this.config.use_blueprint.input[key]) ??
|
this.config.use_blueprint.input[key]) ??
|
||||||
value?.default}
|
value?.default}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@input=${this._inputChanged}
|
@input=${this._inputChanged}
|
||||||
></ha-textfield>`}
|
></ha-textfield>`}
|
||||||
</ha-settings-row>`
|
</ha-settings-row>`
|
||||||
@ -205,6 +218,10 @@ export class HaBlueprintAutomationEditor extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _duplicate() {
|
||||||
|
fireEvent(this, "duplicate");
|
||||||
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
@ -26,6 +26,8 @@ export default class HaAutomationConditionEditor extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) condition!: Condition;
|
@property({ attribute: false }) condition!: Condition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public yamlMode = false;
|
@property({ type: Boolean }) public yamlMode = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
@ -56,6 +58,7 @@ export default class HaAutomationConditionEditor extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.condition}
|
.defaultValue=${this.condition}
|
||||||
@value-changed=${this._onYamlChange}
|
@value-changed=${this._onYamlChange}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
@ -66,6 +69,7 @@ export default class HaAutomationConditionEditor extends LitElement {
|
|||||||
hass: this.hass,
|
hass: this.hass,
|
||||||
condition: condition,
|
condition: condition,
|
||||||
reOrderMode: this.reOrderMode,
|
reOrderMode: this.reOrderMode,
|
||||||
|
disabled: this.disabled,
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +74,8 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _yamlMode = false;
|
@state() private _yamlMode = false;
|
||||||
|
|
||||||
@state() private _warnings?: string[];
|
@state() private _warnings?: string[];
|
||||||
@ -131,7 +133,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
)}
|
)}
|
||||||
<ha-svg-icon slot="graphic" .path=${mdiFlask}></ha-svg-icon>
|
<ha-svg-icon slot="graphic" .path=${mdiFlask}></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.conditions.rename"
|
"ui.panel.config.automation.editor.conditions.rename"
|
||||||
)}
|
)}
|
||||||
@ -140,7 +142,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
.path=${mdiRenameBox}
|
.path=${mdiRenameBox}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.duplicate"
|
"ui.panel.config.automation.editor.actions.duplicate"
|
||||||
)}
|
)}
|
||||||
@ -180,7 +182,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
|
|
||||||
<li divider role="separator"></li>
|
<li divider role="separator"></li>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.condition.enabled === false
|
${this.condition.enabled === false
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.enable"
|
"ui.panel.config.automation.editor.actions.enable"
|
||||||
@ -195,7 +197,11 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
: mdiStopCircleOutline}
|
: mdiStopCircleOutline}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item class="warning" graphic="icon">
|
<mwc-list-item
|
||||||
|
class="warning"
|
||||||
|
graphic="icon"
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.delete"
|
"ui.panel.config.automation.editor.actions.delete"
|
||||||
)}
|
)}
|
||||||
@ -238,6 +244,7 @@ export default class HaAutomationConditionRow extends LitElement {
|
|||||||
@ui-mode-not-available=${this._handleUiModeNotAvailable}
|
@ui-mode-not-available=${this._handleUiModeNotAvailable}
|
||||||
@value-changed=${this._handleChangeEvent}
|
@value-changed=${this._handleChangeEvent}
|
||||||
.yamlMode=${this._yamlMode}
|
.yamlMode=${this._yamlMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.condition=${this.condition}
|
.condition=${this.condition}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
@ -42,6 +42,8 @@ export default class HaAutomationCondition extends LitElement {
|
|||||||
|
|
||||||
@property() public conditions!: Condition[];
|
@property() public conditions!: Condition[];
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
|
|
||||||
private _focusLastConditionOnChange = false;
|
private _focusLastConditionOnChange = false;
|
||||||
@ -111,6 +113,7 @@ export default class HaAutomationCondition extends LitElement {
|
|||||||
.condition=${cond}
|
.condition=${cond}
|
||||||
.hideMenu=${this.reOrderMode}
|
.hideMenu=${this.reOrderMode}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@duplicate=${this._duplicateCondition}
|
@duplicate=${this._duplicateCondition}
|
||||||
@move-condition=${this._move}
|
@move-condition=${this._move}
|
||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
@ -147,10 +150,15 @@ export default class HaAutomationCondition extends LitElement {
|
|||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ha-button-menu fixed @action=${this._addCondition}>
|
<ha-button-menu
|
||||||
|
fixed
|
||||||
|
@action=${this._addCondition}
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
<mwc-button
|
<mwc-button
|
||||||
slot="trigger"
|
slot="trigger"
|
||||||
outlined
|
outlined
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.conditions.add"
|
"ui.panel.config.automation.editor.conditions.add"
|
||||||
)}
|
)}
|
||||||
|
@ -19,6 +19,8 @@ export class HaDeviceCondition extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Object }) public condition!: DeviceCondition;
|
@property({ type: Object }) public condition!: DeviceCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _deviceId?: string;
|
@state() private _deviceId?: string;
|
||||||
|
|
||||||
@state() private _capabilities?: DeviceCapabilities;
|
@state() private _capabilities?: DeviceCapabilities;
|
||||||
@ -53,7 +55,8 @@ export class HaDeviceCondition extends LitElement {
|
|||||||
.value=${deviceId}
|
.value=${deviceId}
|
||||||
@value-changed=${this._devicePicked}
|
@value-changed=${this._devicePicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
label=${this.hass.localize(
|
.disabled=${this.disabled}
|
||||||
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.conditions.type.device.label"
|
"ui.panel.config.automation.editor.conditions.type.device.label"
|
||||||
)}
|
)}
|
||||||
></ha-device-picker>
|
></ha-device-picker>
|
||||||
@ -62,7 +65,8 @@ export class HaDeviceCondition extends LitElement {
|
|||||||
.deviceId=${deviceId}
|
.deviceId=${deviceId}
|
||||||
@value-changed=${this._deviceConditionPicked}
|
@value-changed=${this._deviceConditionPicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
label=${this.hass.localize(
|
.disabled=${this.disabled}
|
||||||
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.conditions.type.device.condition"
|
"ui.panel.config.automation.editor.conditions.type.device.condition"
|
||||||
)}
|
)}
|
||||||
></ha-device-condition-picker>
|
></ha-device-condition-picker>
|
||||||
@ -72,6 +76,7 @@ export class HaDeviceCondition extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._extraFieldsData(this.condition, this._capabilities)}
|
.data=${this._extraFieldsData(this.condition, this._capabilities)}
|
||||||
.schema=${this._capabilities.extra_fields}
|
.schema=${this._capabilities.extra_fields}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
||||||
this.hass.localize
|
this.hass.localize
|
||||||
)}
|
)}
|
||||||
|
@ -12,6 +12,8 @@ export class HaLogicalCondition extends LitElement implements ConditionElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: LogicalCondition;
|
@property({ attribute: false }) public condition!: LogicalCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
@ -26,6 +28,7 @@ export class HaLogicalCondition extends LitElement implements ConditionElement {
|
|||||||
.conditions=${this.condition.conditions || []}
|
.conditions=${this.condition.conditions || []}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
></ha-automation-condition>
|
></ha-automation-condition>
|
||||||
`;
|
`;
|
||||||
|
@ -13,6 +13,8 @@ export default class HaNumericStateCondition extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: NumericStateCondition;
|
@property({ attribute: false }) public condition!: NumericStateCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {
|
return {
|
||||||
entity_id: "",
|
entity_id: "",
|
||||||
@ -132,6 +134,7 @@ export default class HaNumericStateCondition extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this.condition}
|
.data=${this.condition}
|
||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -26,6 +26,8 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: StateCondition;
|
@property({ attribute: false }) public condition!: StateCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { entity_id: "", state: "" };
|
return { entity_id: "", state: "" };
|
||||||
}
|
}
|
||||||
@ -100,6 +102,7 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${data}
|
.data=${data}
|
||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -15,6 +15,8 @@ export class HaSunCondition extends LitElement implements ConditionElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: SunCondition;
|
@property({ attribute: false }) public condition!: SunCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -72,6 +74,7 @@ export class HaSunCondition extends LitElement implements ConditionElement {
|
|||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
.data=${this.condition}
|
.data=${this.condition}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -11,6 +11,8 @@ export class HaTemplateCondition extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: TemplateCondition;
|
@property({ attribute: false }) public condition!: TemplateCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { value_template: "" };
|
return { value_template: "" };
|
||||||
}
|
}
|
||||||
@ -29,6 +31,7 @@ export class HaTemplateCondition extends LitElement {
|
|||||||
mode="jinja2"
|
mode="jinja2"
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${value_template}
|
.value=${value_template}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
autocomplete-entities
|
autocomplete-entities
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
|
@ -21,6 +21,8 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
|
|
||||||
@state() private _inputModeAfter?: boolean;
|
@state() private _inputModeAfter?: boolean;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -123,6 +125,7 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${data}
|
.data=${data}
|
||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -18,6 +18,8 @@ export class HaTriggerCondition extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: TriggerCondition;
|
@property({ attribute: false }) public condition!: TriggerCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _triggers: Trigger[] = [];
|
@state() private _triggers: Trigger[] = [];
|
||||||
|
|
||||||
private _unsub?: UnsubscribeFunc;
|
private _unsub?: UnsubscribeFunc;
|
||||||
@ -55,6 +57,7 @@ export class HaTriggerCondition extends LitElement {
|
|||||||
"ui.panel.config.automation.editor.conditions.type.trigger.id"
|
"ui.panel.config.automation.editor.conditions.type.trigger.id"
|
||||||
)}
|
)}
|
||||||
.value=${id}
|
.value=${id}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@selected=${this._triggerPicked}
|
@selected=${this._triggerPicked}
|
||||||
>
|
>
|
||||||
${this._triggers.map(
|
${this._triggers.map(
|
||||||
|
@ -20,6 +20,8 @@ export class HaZoneCondition extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public condition!: ZoneCondition;
|
@property({ attribute: false }) public condition!: ZoneCondition;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {
|
return {
|
||||||
entity_id: "",
|
entity_id: "",
|
||||||
@ -37,6 +39,7 @@ export class HaZoneCondition extends LitElement {
|
|||||||
.value=${entity_id}
|
.value=${entity_id}
|
||||||
@value-changed=${this._entityPicked}
|
@value-changed=${this._entityPicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
.entityFilter=${zoneAndLocationFilter}
|
.entityFilter=${zoneAndLocationFilter}
|
||||||
></ha-entity-picker>
|
></ha-entity-picker>
|
||||||
@ -47,6 +50,7 @@ export class HaZoneCondition extends LitElement {
|
|||||||
.value=${zone}
|
.value=${zone}
|
||||||
@value-changed=${this._zonePicked}
|
@value-changed=${this._zonePicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
.includeDomains=${includeDomains}
|
.includeDomains=${includeDomains}
|
||||||
></ha-entity-picker>
|
></ha-entity-picker>
|
||||||
|
@ -43,7 +43,8 @@ import {
|
|||||||
AutomationConfig,
|
AutomationConfig,
|
||||||
AutomationEntity,
|
AutomationEntity,
|
||||||
deleteAutomation,
|
deleteAutomation,
|
||||||
getAutomationConfig,
|
getAutomationStateConfig,
|
||||||
|
fetchAutomationFileConfig,
|
||||||
getAutomationEditorInitData,
|
getAutomationEditorInitData,
|
||||||
saveAutomationConfig,
|
saveAutomationConfig,
|
||||||
showAutomationEditor,
|
showAutomationEditor,
|
||||||
@ -86,6 +87,8 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
|
|
||||||
@property() public automationId: string | null = null;
|
@property() public automationId: string | null = null;
|
||||||
|
|
||||||
|
@property() public entityId: string | null = null;
|
||||||
|
|
||||||
@property() public automations!: AutomationEntity[];
|
@property() public automations!: AutomationEntity[];
|
||||||
|
|
||||||
@property() public isWide?: boolean;
|
@property() public isWide?: boolean;
|
||||||
@ -104,6 +107,8 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
|
|
||||||
@state() private _mode: "gui" | "yaml" = "gui";
|
@state() private _mode: "gui" | "yaml" = "gui";
|
||||||
|
|
||||||
|
@state() private _readOnly = false;
|
||||||
|
|
||||||
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;
|
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;
|
||||||
|
|
||||||
@query("manual-automation-editor")
|
@query("manual-automation-editor")
|
||||||
@ -198,7 +203,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
<mwc-list-item
|
<mwc-list-item
|
||||||
graphic="icon"
|
graphic="icon"
|
||||||
@click=${this._promptAutomationMode}
|
@click=${this._promptAutomationMode}
|
||||||
.disabled=${this._mode === "yaml"}
|
.disabled=${this._readOnly || this._mode === "yaml"}
|
||||||
>
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.change_mode"
|
"ui.panel.config.automation.editor.change_mode"
|
||||||
@ -214,7 +219,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
? html`<mwc-list-item
|
? html`<mwc-list-item
|
||||||
graphic="icon"
|
graphic="icon"
|
||||||
@click=${this._toggleReOrderMode}
|
@click=${this._toggleReOrderMode}
|
||||||
.disabled=${this._mode === "yaml"}
|
.disabled=${this._readOnly || this._mode === "yaml"}
|
||||||
>
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.re_order"
|
"ui.panel.config.automation.editor.re_order"
|
||||||
@ -224,11 +229,15 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
: ""}
|
: ""}
|
||||||
|
|
||||||
<mwc-list-item
|
<mwc-list-item
|
||||||
.disabled=${!this.automationId}
|
.disabled=${!this._readOnly && !this.automationId}
|
||||||
graphic="icon"
|
graphic="icon"
|
||||||
@click=${this._duplicate}
|
@click=${this._duplicate}
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.panel.config.automation.picker.duplicate")}
|
${this.hass.localize(
|
||||||
|
this._readOnly
|
||||||
|
? "ui.panel.config.automation.editor.migrate"
|
||||||
|
: "ui.panel.config.automation.editor.duplicate"
|
||||||
|
)}
|
||||||
<ha-svg-icon
|
<ha-svg-icon
|
||||||
slot="graphic"
|
slot="graphic"
|
||||||
.path=${mdiContentDuplicate}
|
.path=${mdiContentDuplicate}
|
||||||
@ -314,7 +323,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
.isWide=${this.isWide}
|
.isWide=${this.isWide}
|
||||||
.stateObj=${stateObj}
|
.stateObj=${stateObj}
|
||||||
.config=${this._config}
|
.config=${this._config}
|
||||||
|
.disabled=${Boolean(this._readOnly)}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
|
@duplicate=${this._duplicate}
|
||||||
></blueprint-automation-editor>
|
></blueprint-automation-editor>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
@ -324,11 +335,25 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
.isWide=${this.isWide}
|
.isWide=${this.isWide}
|
||||||
.stateObj=${stateObj}
|
.stateObj=${stateObj}
|
||||||
.config=${this._config}
|
.config=${this._config}
|
||||||
|
.disabled=${Boolean(this._readOnly)}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
|
@duplicate=${this._duplicate}
|
||||||
></manual-automation-editor>
|
></manual-automation-editor>
|
||||||
`
|
`
|
||||||
: this._mode === "yaml"
|
: this._mode === "yaml"
|
||||||
? html`
|
? html`
|
||||||
|
${this._readOnly
|
||||||
|
? html`<ha-alert alert-type="warning">
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.read_only"
|
||||||
|
)}
|
||||||
|
<mwc-button slot="action" @click=${this._duplicate}>
|
||||||
|
${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.migrate"
|
||||||
|
)}
|
||||||
|
</mwc-button>
|
||||||
|
</ha-alert>`
|
||||||
|
: ""}
|
||||||
${stateObj?.state === "off"
|
${stateObj?.state === "off"
|
||||||
? html`
|
? html`
|
||||||
<ha-alert alert-type="info">
|
<ha-alert alert-type="info">
|
||||||
@ -346,6 +371,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this._preprocessYaml()}
|
.defaultValue=${this._preprocessYaml()}
|
||||||
|
.readOnly=${this._readOnly}
|
||||||
@value-changed=${this._yamlChanged}
|
@value-changed=${this._yamlChanged}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
<ha-card outlined>
|
<ha-card outlined>
|
||||||
@ -390,7 +416,12 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
this._loadConfig();
|
this._loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changedProps.has("automationId") && !this.automationId && this.hass) {
|
if (
|
||||||
|
changedProps.has("automationId") &&
|
||||||
|
!this.automationId &&
|
||||||
|
!this.entityId &&
|
||||||
|
this.hass
|
||||||
|
) {
|
||||||
const initData = getAutomationEditorInitData();
|
const initData = getAutomationEditorInitData();
|
||||||
let baseConfig: Partial<AutomationConfig> = { description: "" };
|
let baseConfig: Partial<AutomationConfig> = { description: "" };
|
||||||
if (!initData || !("use_blueprint" in initData)) {
|
if (!initData || !("use_blueprint" in initData)) {
|
||||||
@ -407,9 +438,19 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
...initData,
|
...initData,
|
||||||
} as AutomationConfig;
|
} as AutomationConfig;
|
||||||
this._entityId = undefined;
|
this._entityId = undefined;
|
||||||
|
this._readOnly = false;
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changedProps.has("entityId") && this.entityId) {
|
||||||
|
getAutomationStateConfig(this.hass, this.entityId).then((c) => {
|
||||||
|
this._config = c.config;
|
||||||
|
});
|
||||||
|
this._entityId = this.entityId;
|
||||||
|
this._dirty = false;
|
||||||
|
this._readOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
changedProps.has("automations") &&
|
changedProps.has("automations") &&
|
||||||
this.automationId &&
|
this.automationId &&
|
||||||
@ -434,7 +475,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
|
|
||||||
private async _loadConfig() {
|
private async _loadConfig() {
|
||||||
try {
|
try {
|
||||||
const config = await getAutomationConfig(
|
const config = await fetchAutomationFileConfig(
|
||||||
this.hass,
|
this.hass,
|
||||||
this.automationId as string
|
this.automationId as string
|
||||||
);
|
);
|
||||||
@ -448,8 +489,19 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._dirty = false;
|
this._dirty = false;
|
||||||
|
this._readOnly = false;
|
||||||
this._config = config;
|
this._config = config;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
const entity = Object.values(this.hass.entities).find(
|
||||||
|
(ent) =>
|
||||||
|
ent.platform === "automation" && ent.unique_id === this.automationId
|
||||||
|
);
|
||||||
|
if (entity) {
|
||||||
|
navigate(`/config/automation/show/${entity.entity_id}`, {
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
text:
|
text:
|
||||||
err.status_code === 404
|
err.status_code === 404
|
||||||
@ -468,6 +520,9 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
|
|
||||||
private _valueChanged(ev: CustomEvent<{ value: AutomationConfig }>) {
|
private _valueChanged(ev: CustomEvent<{ value: AutomationConfig }>) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (this._readOnly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._config = ev.detail.value;
|
this._config = ev.detail.value;
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
this._errors = undefined;
|
this._errors = undefined;
|
||||||
@ -563,12 +618,17 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private async _duplicate() {
|
private async _duplicate() {
|
||||||
const result = await this.confirmUnsavedChanged();
|
const result = this._readOnly
|
||||||
|
? await showConfirmationDialog(this, {
|
||||||
|
title: "Migrate automation?",
|
||||||
|
text: "You can migrate this automation, so it can be edited from the UI. After it is migrated and you have saved it, you will have to manually delete your old automation from your configuration. Do you want to migrate this automation?",
|
||||||
|
})
|
||||||
|
: await this.confirmUnsavedChanged();
|
||||||
if (result) {
|
if (result) {
|
||||||
showAutomationEditor({
|
showAutomationEditor({
|
||||||
...this._config,
|
...this._config,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
alias: undefined,
|
alias: this._readOnly ? this._config?.alias : undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import {
|
|||||||
AutomationEntity,
|
AutomationEntity,
|
||||||
deleteAutomation,
|
deleteAutomation,
|
||||||
duplicateAutomation,
|
duplicateAutomation,
|
||||||
getAutomationConfig,
|
fetchAutomationFileConfig,
|
||||||
triggerAutomationActions,
|
triggerAutomationActions,
|
||||||
} from "../../../data/automation";
|
} from "../../../data/automation";
|
||||||
import {
|
import {
|
||||||
@ -376,7 +376,7 @@ class HaAutomationPicker extends LitElement {
|
|||||||
|
|
||||||
private async duplicate(automation) {
|
private async duplicate(automation) {
|
||||||
try {
|
try {
|
||||||
const config = await getAutomationConfig(
|
const config = await fetchAutomationFileConfig(
|
||||||
this.hass,
|
this.hass,
|
||||||
automation.attributes.id
|
automation.attributes.id
|
||||||
);
|
);
|
||||||
@ -424,6 +424,8 @@ class HaAutomationPicker extends LitElement {
|
|||||||
|
|
||||||
if (automation?.attributes.id) {
|
if (automation?.attributes.id) {
|
||||||
navigate(`/config/automation/edit/${automation.attributes.id}`);
|
navigate(`/config/automation/edit/${automation.attributes.id}`);
|
||||||
|
} else {
|
||||||
|
navigate(`/config/automation/show/${ev.detail.id}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ class HaConfigAutomation extends HassRouterPage {
|
|||||||
edit: {
|
edit: {
|
||||||
tag: "ha-automation-editor",
|
tag: "ha-automation-editor",
|
||||||
},
|
},
|
||||||
|
show: {
|
||||||
|
tag: "ha-automation-editor",
|
||||||
|
},
|
||||||
trace: {
|
trace: {
|
||||||
tag: "ha-automation-trace",
|
tag: "ha-automation-trace",
|
||||||
load: () => import("./ha-automation-trace"),
|
load: () => import("./ha-automation-trace"),
|
||||||
@ -84,13 +87,22 @@ class HaConfigAutomation extends HassRouterPage {
|
|||||||
this._debouncedUpdateAutomations(pageEl);
|
this._debouncedUpdateAutomations(pageEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
(!changedProps || changedProps.has("route")) &&
|
||||||
|
this._currentPage === "show"
|
||||||
|
) {
|
||||||
|
const automationId = decodeURIComponent(this.routeTail.path.substr(1));
|
||||||
|
pageEl.automationId = null;
|
||||||
|
pageEl.entityId = automationId === "new" ? null : automationId;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
(!changedProps || changedProps.has("route")) &&
|
(!changedProps || changedProps.has("route")) &&
|
||||||
this._currentPage !== "dashboard"
|
this._currentPage !== "dashboard"
|
||||||
) {
|
) {
|
||||||
const automationId = decodeURIComponent(this.routeTail.path.substr(1));
|
const automationId = decodeURIComponent(this.routeTail.path.substr(1));
|
||||||
pageEl.automationId = automationId === "new" ? null : automationId;
|
pageEl.automationId = automationId === "new" ? null : automationId;
|
||||||
|
pageEl.entityId = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public narrow!: boolean;
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ attribute: false }) public config!: ManualAutomationConfig;
|
@property({ attribute: false }) public config!: ManualAutomationConfig;
|
||||||
|
|
||||||
@property({ attribute: false }) public stateObj?: HassEntity;
|
@property({ attribute: false }) public stateObj?: HassEntity;
|
||||||
@ -37,6 +39,14 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
|
${this.disabled
|
||||||
|
? html`<ha-alert alert-type="warning">
|
||||||
|
${this.hass.localize("ui.panel.config.automation.editor.read_only")}
|
||||||
|
<mwc-button slot="action" @click=${this._duplicate}>
|
||||||
|
${this.hass.localize("ui.panel.config.automation.editor.migrate")}
|
||||||
|
</mwc-button>
|
||||||
|
</ha-alert>`
|
||||||
|
: ""}
|
||||||
${this.stateObj?.state === "off"
|
${this.stateObj?.state === "off"
|
||||||
? html`
|
? html`
|
||||||
<ha-alert alert-type="info">
|
<ha-alert alert-type="info">
|
||||||
@ -100,6 +110,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
@value-changed=${this._triggerChanged}
|
@value-changed=${this._triggerChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
></ha-automation-trigger>
|
></ha-automation-trigger>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -129,6 +140,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
@value-changed=${this._conditionChanged}
|
@value-changed=${this._conditionChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
></ha-automation-condition>
|
></ha-automation-condition>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
@ -161,6 +173,7 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.reOrderMode=${this.reOrderMode}
|
.reOrderMode=${this.reOrderMode}
|
||||||
|
.disabled=${this.disabled}
|
||||||
></ha-automation-action>
|
></ha-automation-action>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -202,6 +215,10 @@ export class HaManualAutomationEditor extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _duplicate() {
|
||||||
|
fireEvent(this, "duplicate");
|
||||||
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
@ -89,6 +89,8 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public hideMenu = false;
|
@property({ type: Boolean }) public hideMenu = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _warnings?: string[];
|
@state() private _warnings?: string[];
|
||||||
|
|
||||||
@state() private _yamlMode = false;
|
@state() private _yamlMode = false;
|
||||||
@ -148,7 +150,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
.path=${mdiDotsVertical}
|
.path=${mdiDotsVertical}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.rename"
|
"ui.panel.config.automation.editor.triggers.rename"
|
||||||
)}
|
)}
|
||||||
@ -157,7 +159,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
.path=${mdiRenameBox}
|
.path=${mdiRenameBox}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.duplicate"
|
"ui.panel.config.automation.editor.actions.duplicate"
|
||||||
)}
|
)}
|
||||||
@ -167,7 +169,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.edit_id"
|
"ui.panel.config.automation.editor.triggers.edit_id"
|
||||||
)}
|
)}
|
||||||
@ -207,7 +209,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
|
|
||||||
<li divider role="separator"></li>
|
<li divider role="separator"></li>
|
||||||
|
|
||||||
<mwc-list-item graphic="icon">
|
<mwc-list-item graphic="icon" .disabled=${this.disabled}>
|
||||||
${this.trigger.enabled === false
|
${this.trigger.enabled === false
|
||||||
? this.hass.localize(
|
? this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.enable"
|
"ui.panel.config.automation.editor.actions.enable"
|
||||||
@ -222,7 +224,11 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
: mdiStopCircleOutline}
|
: mdiStopCircleOutline}
|
||||||
></ha-svg-icon>
|
></ha-svg-icon>
|
||||||
</mwc-list-item>
|
</mwc-list-item>
|
||||||
<mwc-list-item class="warning" graphic="icon">
|
<mwc-list-item
|
||||||
|
class="warning"
|
||||||
|
graphic="icon"
|
||||||
|
.disabled=${this.disabled}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.actions.delete"
|
"ui.panel.config.automation.editor.actions.delete"
|
||||||
)}
|
)}
|
||||||
@ -273,6 +279,7 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.defaultValue=${this.trigger}
|
.defaultValue=${this.trigger}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
@value-changed=${this._onYamlChange}
|
@value-changed=${this._onYamlChange}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
`
|
`
|
||||||
@ -292,7 +299,11 @@ export default class HaAutomationTriggerRow extends LitElement {
|
|||||||
<div @ui-mode-not-available=${this._handleUiModeNotAvailable}>
|
<div @ui-mode-not-available=${this._handleUiModeNotAvailable}>
|
||||||
${dynamicElement(
|
${dynamicElement(
|
||||||
`ha-automation-trigger-${this.trigger.platform}`,
|
`ha-automation-trigger-${this.trigger.platform}`,
|
||||||
{ hass: this.hass, trigger: this.trigger }
|
{
|
||||||
|
hass: this.hass,
|
||||||
|
trigger: this.trigger,
|
||||||
|
disabled: this.disabled,
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
`}
|
`}
|
||||||
|
@ -45,6 +45,8 @@ export default class HaAutomationTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Boolean }) public reOrderMode = false;
|
@property({ type: Boolean }) public reOrderMode = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _focusLastTriggerOnChange = false;
|
private _focusLastTriggerOnChange = false;
|
||||||
|
|
||||||
private _triggerKeys = new WeakMap<Trigger, string>();
|
private _triggerKeys = new WeakMap<Trigger, string>();
|
||||||
@ -65,6 +67,7 @@ export default class HaAutomationTrigger extends LitElement {
|
|||||||
@duplicate=${this._duplicateTrigger}
|
@duplicate=${this._duplicateTrigger}
|
||||||
@value-changed=${this._triggerChanged}
|
@value-changed=${this._triggerChanged}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
>
|
>
|
||||||
${this.reOrderMode
|
${this.reOrderMode
|
||||||
? html`
|
? html`
|
||||||
@ -97,13 +100,14 @@ export default class HaAutomationTrigger extends LitElement {
|
|||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ha-button-menu @action=${this._addTrigger}>
|
<ha-button-menu @action=${this._addTrigger} .disabled=${this.disabled}>
|
||||||
<mwc-button
|
<mwc-button
|
||||||
slot="trigger"
|
slot="trigger"
|
||||||
outlined
|
outlined
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.add"
|
"ui.panel.config.automation.editor.triggers.add"
|
||||||
)}
|
)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
>
|
>
|
||||||
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
|
<ha-svg-icon .path=${mdiPlus} slot="icon"></ha-svg-icon>
|
||||||
</mwc-button>
|
</mwc-button>
|
||||||
|
@ -17,6 +17,8 @@ export class HaCalendarTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: CalendarTrigger;
|
@property({ attribute: false }) public trigger!: CalendarTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc) =>
|
(localize: LocalizeFunc) =>
|
||||||
[
|
[
|
||||||
@ -97,6 +99,7 @@ export class HaCalendarTrigger extends LitElement implements TriggerElement {
|
|||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
.data=${data}
|
.data=${data}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -19,6 +19,8 @@ export class HaDeviceTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ type: Object }) public trigger!: DeviceTrigger;
|
@property({ type: Object }) public trigger!: DeviceTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _deviceId?: string;
|
@state() private _deviceId?: string;
|
||||||
|
|
||||||
@state() private _capabilities?: DeviceCapabilities;
|
@state() private _capabilities?: DeviceCapabilities;
|
||||||
@ -53,6 +55,7 @@ export class HaDeviceTrigger extends LitElement {
|
|||||||
.value=${deviceId}
|
.value=${deviceId}
|
||||||
@value-changed=${this._devicePicked}
|
@value-changed=${this._devicePicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
label=${this.hass.localize(
|
label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.device.label"
|
"ui.panel.config.automation.editor.triggers.type.device.label"
|
||||||
)}
|
)}
|
||||||
@ -62,6 +65,7 @@ export class HaDeviceTrigger extends LitElement {
|
|||||||
.deviceId=${deviceId}
|
.deviceId=${deviceId}
|
||||||
@value-changed=${this._deviceTriggerPicked}
|
@value-changed=${this._deviceTriggerPicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
label=${this.hass.localize(
|
label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.device.trigger"
|
"ui.panel.config.automation.editor.triggers.type.device.trigger"
|
||||||
)}
|
)}
|
||||||
@ -72,6 +76,7 @@ export class HaDeviceTrigger extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${this._extraFieldsData(this.trigger, this._capabilities)}
|
.data=${this._extraFieldsData(this.trigger, this._capabilities)}
|
||||||
.schema=${this._capabilities.extra_fields}
|
.schema=${this._capabilities.extra_fields}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
.computeLabel=${this._extraFieldsComputeLabelCallback(
|
||||||
this.hass.localize
|
this.hass.localize
|
||||||
)}
|
)}
|
||||||
|
@ -17,6 +17,8 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property() public trigger!: EventTrigger;
|
@property() public trigger!: EventTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { event_type: "" };
|
return { event_type: "" };
|
||||||
}
|
}
|
||||||
@ -30,6 +32,7 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
|
|||||||
)}
|
)}
|
||||||
name="event_type"
|
name="event_type"
|
||||||
.value=${event_type}
|
.value=${event_type}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@change=${this._valueChanged}
|
@change=${this._valueChanged}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
@ -38,6 +41,7 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
|
|||||||
"ui.panel.config.automation.editor.triggers.type.event.event_data"
|
"ui.panel.config.automation.editor.triggers.type.event.event_data"
|
||||||
)}
|
)}
|
||||||
.name=${"event_data"}
|
.name=${"event_data"}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
.defaultValue=${event_data}
|
.defaultValue=${event_data}
|
||||||
@value-changed=${this._dataChanged}
|
@value-changed=${this._dataChanged}
|
||||||
></ha-yaml-editor>
|
></ha-yaml-editor>
|
||||||
@ -53,6 +57,7 @@ export class HaEventTrigger extends LitElement implements TriggerElement {
|
|||||||
"ui.panel.config.automation.editor.triggers.type.event.context_user_pick"
|
"ui.panel.config.automation.editor.triggers.type.event.context_user_pick"
|
||||||
)}
|
)}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.value=${this._wrapUsersInArray(context?.user_id)}
|
.value=${this._wrapUsersInArray(context?.user_id)}
|
||||||
@value-changed=${this._usersChanged}
|
@value-changed=${this._usersChanged}
|
||||||
></ha-users-picker>
|
></ha-users-picker>
|
||||||
|
@ -14,6 +14,8 @@ export class HaGeolocationTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: GeoLocationTrigger;
|
@property({ attribute: false }) public trigger!: GeoLocationTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc) =>
|
(localize: LocalizeFunc) =>
|
||||||
[
|
[
|
||||||
@ -55,6 +57,7 @@ export class HaGeolocationTrigger extends LitElement {
|
|||||||
.schema=${this._schema(this.hass.localize)}
|
.schema=${this._schema(this.hass.localize)}
|
||||||
.data=${this.trigger}
|
.data=${this.trigger}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -14,6 +14,8 @@ export class HaHassTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: HassTrigger;
|
@property({ attribute: false }) public trigger!: HassTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc) =>
|
(localize: LocalizeFunc) =>
|
||||||
[
|
[
|
||||||
@ -51,6 +53,7 @@ export class HaHassTrigger extends LitElement {
|
|||||||
.schema=${this._schema(this.hass.localize)}
|
.schema=${this._schema(this.hass.localize)}
|
||||||
.data=${this.trigger}
|
.data=${this.trigger}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -18,6 +18,8 @@ export class HaMQTTTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: MqttTrigger;
|
@property({ attribute: false }) public trigger!: MqttTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { topic: "" };
|
return { topic: "" };
|
||||||
}
|
}
|
||||||
@ -28,6 +30,7 @@ export class HaMQTTTrigger extends LitElement implements TriggerElement {
|
|||||||
.schema=${SCHEMA}
|
.schema=${SCHEMA}
|
||||||
.data=${this.trigger}
|
.data=${this.trigger}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -15,6 +15,8 @@ export class HaNumericStateTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: NumericStateTrigger;
|
@property({ attribute: false }) public trigger!: NumericStateTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(entityId) =>
|
(entityId) =>
|
||||||
[
|
[
|
||||||
@ -152,6 +154,7 @@ export class HaNumericStateTrigger extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${data}
|
.data=${data}
|
||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -41,6 +41,8 @@ export class HaStateTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: StateTrigger;
|
@property({ attribute: false }) public trigger!: StateTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { entity_id: [] };
|
return { entity_id: [] };
|
||||||
}
|
}
|
||||||
@ -155,6 +157,7 @@ export class HaStateTrigger extends LitElement implements TriggerElement {
|
|||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
|
.disabled=${this.disabled}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ export class HaSunTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: SunTrigger;
|
@property({ attribute: false }) public trigger!: SunTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
private _schema = memoizeOne(
|
private _schema = memoizeOne(
|
||||||
(localize: LocalizeFunc) =>
|
(localize: LocalizeFunc) =>
|
||||||
[
|
[
|
||||||
@ -55,6 +57,7 @@ export class HaSunTrigger extends LitElement implements TriggerElement {
|
|||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
.data=${this.trigger}
|
.data=${this.trigger}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -15,6 +15,8 @@ export class HaTagTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property() public trigger!: TagTrigger;
|
@property() public trigger!: TagTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _tags?: Tag[];
|
@state() private _tags?: Tag[];
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
@ -35,7 +37,7 @@ export class HaTagTrigger extends LitElement implements TriggerElement {
|
|||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.tag.label"
|
"ui.panel.config.automation.editor.triggers.type.tag.label"
|
||||||
)}
|
)}
|
||||||
.disabled=${this._tags.length === 0}
|
.disabled=${this.disabled || this._tags.length === 0}
|
||||||
.value=${this.trigger.tag_id}
|
.value=${this.trigger.tag_id}
|
||||||
@selected=${this._tagChanged}
|
@selected=${this._tagChanged}
|
||||||
>
|
>
|
||||||
|
@ -11,6 +11,8 @@ export class HaTemplateTrigger extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: TemplateTrigger;
|
@property({ attribute: false }) public trigger!: TemplateTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return { value_template: "" };
|
return { value_template: "" };
|
||||||
}
|
}
|
||||||
@ -29,6 +31,7 @@ export class HaTemplateTrigger extends LitElement {
|
|||||||
mode="jinja2"
|
mode="jinja2"
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${value_template}
|
.value=${value_template}
|
||||||
|
.readOnly=${this.disabled}
|
||||||
autocomplete-entities
|
autocomplete-entities
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
|
@ -15,6 +15,8 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: TimeTrigger;
|
@property({ attribute: false }) public trigger!: TimeTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _inputMode?: boolean;
|
@state() private _inputMode?: boolean;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
@ -89,6 +91,7 @@ export class HaTimeTrigger extends LitElement implements TriggerElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.data=${data}
|
.data=${data}
|
||||||
.schema=${schema}
|
.schema=${schema}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -19,6 +19,8 @@ export class HaTimePatternTrigger extends LitElement implements TriggerElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public trigger!: TimePatternTrigger;
|
@property({ attribute: false }) public trigger!: TimePatternTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -29,6 +31,7 @@ export class HaTimePatternTrigger extends LitElement implements TriggerElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.schema=${SCHEMA}
|
.schema=${SCHEMA}
|
||||||
.data=${this.trigger}
|
.data=${this.trigger}
|
||||||
|
.disabled=${this.disabled}
|
||||||
.computeLabel=${this._computeLabelCallback}
|
.computeLabel=${this._computeLabelCallback}
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-form>
|
></ha-form>
|
||||||
|
@ -24,6 +24,8 @@ export class HaWebhookTrigger extends LitElement {
|
|||||||
|
|
||||||
@property() public trigger!: WebhookTrigger;
|
@property() public trigger!: WebhookTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@state() private _config?: AutomationConfig;
|
@state() private _config?: AutomationConfig;
|
||||||
|
|
||||||
private _unsub?: UnsubscribeFunc;
|
private _unsub?: UnsubscribeFunc;
|
||||||
@ -88,6 +90,7 @@ export class HaWebhookTrigger extends LitElement {
|
|||||||
.helper=${this.hass.localize(
|
.helper=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.webhook.webhook_id_helper"
|
"ui.panel.config.automation.editor.triggers.type.webhook.webhook_id_helper"
|
||||||
)}
|
)}
|
||||||
|
.disabled=${this.disabled}
|
||||||
iconTrailing
|
iconTrailing
|
||||||
.value=${webhookId || ""}
|
.value=${webhookId || ""}
|
||||||
@input=${this._valueChanged}
|
@input=${this._valueChanged}
|
||||||
|
@ -22,6 +22,8 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
|
|
||||||
@property() public trigger!: ZoneTrigger;
|
@property() public trigger!: ZoneTrigger;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
public static get defaultConfig() {
|
public static get defaultConfig() {
|
||||||
return {
|
return {
|
||||||
entity_id: "",
|
entity_id: "",
|
||||||
@ -38,6 +40,7 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
"ui.panel.config.automation.editor.triggers.type.zone.entity"
|
"ui.panel.config.automation.editor.triggers.type.zone.entity"
|
||||||
)}
|
)}
|
||||||
.value=${entity_id}
|
.value=${entity_id}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._entityPicked}
|
@value-changed=${this._entityPicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
@ -48,6 +51,7 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
"ui.panel.config.automation.editor.triggers.type.zone.zone"
|
"ui.panel.config.automation.editor.triggers.type.zone.zone"
|
||||||
)}
|
)}
|
||||||
.value=${zone}
|
.value=${zone}
|
||||||
|
.disabled=${this.disabled}
|
||||||
@value-changed=${this._zonePicked}
|
@value-changed=${this._zonePicked}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
@ -59,6 +63,7 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
"ui.panel.config.automation.editor.triggers.type.zone.event"
|
"ui.panel.config.automation.editor.triggers.type.zone.event"
|
||||||
)}
|
)}
|
||||||
<ha-formfield
|
<ha-formfield
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.zone.enter"
|
"ui.panel.config.automation.editor.triggers.type.zone.enter"
|
||||||
)}
|
)}
|
||||||
@ -66,11 +71,13 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
<ha-radio
|
<ha-radio
|
||||||
name="event"
|
name="event"
|
||||||
value="enter"
|
value="enter"
|
||||||
|
.disabled=${this.disabled}
|
||||||
.checked=${event === "enter"}
|
.checked=${event === "enter"}
|
||||||
@change=${this._radioGroupPicked}
|
@change=${this._radioGroupPicked}
|
||||||
></ha-radio>
|
></ha-radio>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
<ha-formfield
|
<ha-formfield
|
||||||
|
.disabled=${this.disabled}
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.automation.editor.triggers.type.zone.leave"
|
"ui.panel.config.automation.editor.triggers.type.zone.leave"
|
||||||
)}
|
)}
|
||||||
@ -78,6 +85,7 @@ export class HaZoneTrigger extends LitElement {
|
|||||||
<ha-radio
|
<ha-radio
|
||||||
name="event"
|
name="event"
|
||||||
value="leave"
|
value="leave"
|
||||||
|
.disabled=${this.disabled}
|
||||||
.checked=${event === "leave"}
|
.checked=${event === "leave"}
|
||||||
@change=${this._radioGroupPicked}
|
@change=${this._radioGroupPicked}
|
||||||
></ha-radio>
|
></ha-radio>
|
||||||
|
@ -1847,6 +1847,8 @@
|
|||||||
"enable": "[%key:ui::common::enable%]",
|
"enable": "[%key:ui::common::enable%]",
|
||||||
"disable": "[%key:ui::common::disable%]",
|
"disable": "[%key:ui::common::disable%]",
|
||||||
"disabled": "Automation is disabled",
|
"disabled": "Automation is disabled",
|
||||||
|
"read_only": "This automation can not be edited from the UI, because it is not stored in the automations.yaml file, or doesn't have an ID.",
|
||||||
|
"migrate": "Migrate",
|
||||||
"run": "[%key:ui::panel::config::automation::editor::actions::run%]",
|
"run": "[%key:ui::panel::config::automation::editor::actions::run%]",
|
||||||
"rename": "[%key:ui::panel::config::automation::editor::triggers::rename%]",
|
"rename": "[%key:ui::panel::config::automation::editor::triggers::rename%]",
|
||||||
"show_trace": "Traces",
|
"show_trace": "Traces",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user