mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 21:47:46 +00:00
Allow multiple states in state condition editor
This commit is contained in:
parent
4dcf26236e
commit
c448bbc3b4
@ -30,6 +30,9 @@ export const handleChangeEvent = (
|
|||||||
ev: CustomEvent
|
ev: CustomEvent
|
||||||
) => {
|
) => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (ev.detail.isValid === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const name = (ev.target as any)?.name;
|
const name = (ev.target as any)?.name;
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return;
|
return;
|
||||||
|
@ -41,14 +41,27 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
|||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
allow-custom-value
|
allow-custom-value
|
||||||
></ha-entity-attribute-picker>
|
></ha-entity-attribute-picker>
|
||||||
<paper-input
|
${Array.isArray(state)
|
||||||
.label=${this.hass.localize(
|
? html`
|
||||||
"ui.panel.config.automation.editor.conditions.type.state.state"
|
<ha-yaml-editor
|
||||||
)}
|
.label=${this.hass.localize(
|
||||||
.name=${"state"}
|
"ui.panel.config.automation.editor.conditions.type.state.state"
|
||||||
.value=${state}
|
) + " (YAML)"}
|
||||||
@value-changed=${this._valueChanged}
|
.defaultValue=${state}
|
||||||
></paper-input>
|
.name=${"state"}
|
||||||
|
@value-changed=${this._valueChanged}
|
||||||
|
></ha-yaml-editor>
|
||||||
|
`
|
||||||
|
: html`
|
||||||
|
<paper-input
|
||||||
|
.label=${this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.conditions.type.state.state"
|
||||||
|
)}
|
||||||
|
.name=${"state"}
|
||||||
|
.value=${state}
|
||||||
|
@value-changed=${this._valueChanged}
|
||||||
|
></paper-input>
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user