Only update device class if changed by user (#13551)

This commit is contained in:
Erik Montnemery 2022-09-01 14:25:32 +02:00 committed by GitHub
parent 604e5d5e09
commit 2bf0c5d72d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -872,10 +872,17 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
name: this._name.trim() || null,
icon: this._icon.trim() || null,
area_id: this._areaId || null,
device_class: this._deviceClass || null,
new_entity_id: this._entityId.trim(),
};
// Only update device class if changed by user
if (
this._deviceClass !==
(this.entry.device_class || this.entry.original_device_class)
) {
params.device_class = this._deviceClass;
}
const stateObj: HassEntity | undefined =
this.hass.states[this.entry.entity_id];
const domain = computeDomain(this.entry.entity_id);