mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +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}
|
||||
</paper-item>
|
||||
<paper-item
|
||||
key=${UNKNOWN_AUTOMATION_KEY}
|
||||
.automation=${this.value}
|
||||
hidden
|
||||
>
|
||||
<paper-item key=${UNKNOWN_AUTOMATION_KEY} hidden>
|
||||
${this.UNKNOWN_AUTOMATION_TEXT}
|
||||
</paper-item>
|
||||
${this._automations.map(
|
||||
@ -175,18 +171,17 @@ export abstract class HaDeviceAutomationPicker<
|
||||
}
|
||||
|
||||
private _automationChanged(ev) {
|
||||
this._setValue(ev.detail.item.automation);
|
||||
if (ev.detail.item.automation) {
|
||||
this._setValue(ev.detail.item.automation);
|
||||
}
|
||||
}
|
||||
|
||||
private _setValue(automation: T) {
|
||||
if (this.value && deviceAutomationsEqual(automation, this.value)) {
|
||||
return;
|
||||
}
|
||||
this.value = automation;
|
||||
setTimeout(() => {
|
||||
fireEvent(this, "change");
|
||||
fireEvent(this, "value-changed", { value: automation });
|
||||
}, 0);
|
||||
fireEvent(this, "change");
|
||||
fireEvent(this, "value-changed", { value: automation });
|
||||
}
|
||||
|
||||
static get styles(): CSSResult {
|
||||
|
@ -97,6 +97,7 @@ export class HaDeviceAction extends LitElement {
|
||||
protected updated(changedPros) {
|
||||
const prevAction = changedPros.get("action");
|
||||
if (prevAction && !deviceAutomationsEqual(prevAction, this.action)) {
|
||||
this._deviceId = undefined;
|
||||
this._getCapabilities();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user