mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
Only update disabled for entity reg if it is a user value. (#4646)
This commit is contained in:
parent
27ebcc1bda
commit
adec2fc2df
@ -20,6 +20,7 @@ import {
|
|||||||
EntityRegistryEntry,
|
EntityRegistryEntry,
|
||||||
removeEntityRegistryEntry,
|
removeEntityRegistryEntry,
|
||||||
updateEntityRegistryEntry,
|
updateEntityRegistryEntry,
|
||||||
|
EntityRegistryEntryUpdateParams,
|
||||||
} from "../../../data/entity_registry";
|
} from "../../../data/entity_registry";
|
||||||
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
|
||||||
import { PolymerChangedEvent } from "../../../polymer-types";
|
import { PolymerChangedEvent } from "../../../polymer-types";
|
||||||
@ -159,12 +160,15 @@ export class EntityRegistrySettings extends LitElement {
|
|||||||
|
|
||||||
private async _updateEntry(): Promise<void> {
|
private async _updateEntry(): Promise<void> {
|
||||||
this._submitting = true;
|
this._submitting = true;
|
||||||
|
const params: Partial<EntityRegistryEntryUpdateParams> = {
|
||||||
|
name: this._name.trim() || null,
|
||||||
|
new_entity_id: this._entityId.trim(),
|
||||||
|
};
|
||||||
|
if (this._disabledBy === null || this._disabledBy === "user") {
|
||||||
|
params.disabled_by = this._disabledBy;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await updateEntityRegistryEntry(this.hass!, this._origEntityId, {
|
await updateEntityRegistryEntry(this.hass!, this._origEntityId, params);
|
||||||
name: this._name.trim() || null,
|
|
||||||
disabled_by: this._disabledBy,
|
|
||||||
new_entity_id: this._entityId.trim(),
|
|
||||||
});
|
|
||||||
fireEvent(this as HTMLElement, "close-dialog");
|
fireEvent(this as HTMLElement, "close-dialog");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._error = err.message || "Unknown error";
|
this._error = err.message || "Unknown error";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user