mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Fix removing/moving device actions (#6441)
Fixes https://github.com/home-assistant/frontend/issues/6438
This commit is contained in:
parent
16473c9177
commit
e08c10315e
@ -117,11 +117,7 @@ export abstract class HaDeviceAutomationPicker<
|
|||||||
>
|
>
|
||||||
${this.NO_AUTOMATION_TEXT}
|
${this.NO_AUTOMATION_TEXT}
|
||||||
</paper-item>
|
</paper-item>
|
||||||
<paper-item
|
<paper-item key=${UNKNOWN_AUTOMATION_KEY} hidden>
|
||||||
key=${UNKNOWN_AUTOMATION_KEY}
|
|
||||||
.automation=${this.value}
|
|
||||||
hidden
|
|
||||||
>
|
|
||||||
${this.UNKNOWN_AUTOMATION_TEXT}
|
${this.UNKNOWN_AUTOMATION_TEXT}
|
||||||
</paper-item>
|
</paper-item>
|
||||||
${this._automations.map(
|
${this._automations.map(
|
||||||
@ -175,18 +171,17 @@ export abstract class HaDeviceAutomationPicker<
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _automationChanged(ev) {
|
private _automationChanged(ev) {
|
||||||
this._setValue(ev.detail.item.automation);
|
if (ev.detail.item.automation) {
|
||||||
|
this._setValue(ev.detail.item.automation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setValue(automation: T) {
|
private _setValue(automation: T) {
|
||||||
if (this.value && deviceAutomationsEqual(automation, this.value)) {
|
if (this.value && deviceAutomationsEqual(automation, this.value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.value = automation;
|
fireEvent(this, "change");
|
||||||
setTimeout(() => {
|
fireEvent(this, "value-changed", { value: automation });
|
||||||
fireEvent(this, "change");
|
|
||||||
fireEvent(this, "value-changed", { value: automation });
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult {
|
static get styles(): CSSResult {
|
||||||
|
@ -97,6 +97,7 @@ export class HaDeviceAction extends LitElement {
|
|||||||
protected updated(changedPros) {
|
protected updated(changedPros) {
|
||||||
const prevAction = changedPros.get("action");
|
const prevAction = changedPros.get("action");
|
||||||
if (prevAction && !deviceAutomationsEqual(prevAction, this.action)) {
|
if (prevAction && !deviceAutomationsEqual(prevAction, this.action)) {
|
||||||
|
this._deviceId = undefined;
|
||||||
this._getCapabilities();
|
this._getCapabilities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user