mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 04:36:36 +00:00
Fix saving entities of the device in scene editor (#8884)
This commit is contained in:
parent
9eb59062aa
commit
ea60f7005b
@ -556,20 +556,18 @@ export class HaSceneEditor extends SubscribeMixin(
|
|||||||
if (this._entities.includes(entityId)) {
|
if (this._entities.includes(entityId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._entities = [...this._entities, entityId];
|
|
||||||
this._storeState(entityId);
|
|
||||||
|
|
||||||
const entityRegistry = this._entityRegistryEntries.find(
|
const entityRegistry = this._entityRegistryEntries.find(
|
||||||
(entityReg) => entityReg.entity_id === entityId
|
(entityReg) => entityReg.entity_id === entityId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
entityRegistry?.device_id &&
|
entityRegistry?.device_id &&
|
||||||
!this._devices.includes(entityRegistry.device_id)
|
!this._devices.includes(entityRegistry.device_id)
|
||||||
) {
|
) {
|
||||||
this._devices = [...this._devices, entityRegistry.device_id];
|
this._pickDevice(entityRegistry.device_id);
|
||||||
|
} else {
|
||||||
|
this._entities = [...this._entities, entityId];
|
||||||
|
this._storeState(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,14 +580,12 @@ export class HaSceneEditor extends SubscribeMixin(
|
|||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _devicePicked(ev: CustomEvent) {
|
private _pickDevice(device_id: string) {
|
||||||
const device = ev.detail.value;
|
if (this._devices.includes(device_id)) {
|
||||||
(ev.target as any).value = "";
|
|
||||||
if (this._devices.includes(device)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._devices = [...this._devices, device];
|
this._devices = [...this._devices, device_id];
|
||||||
const deviceEntities = this._deviceEntityLookup[device];
|
const deviceEntities = this._deviceEntityLookup[device_id];
|
||||||
if (!deviceEntities) {
|
if (!deviceEntities) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -600,6 +596,12 @@ export class HaSceneEditor extends SubscribeMixin(
|
|||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _devicePicked(ev: CustomEvent) {
|
||||||
|
const device = ev.detail.value;
|
||||||
|
(ev.target as any).value = "";
|
||||||
|
this._pickDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
private _deleteDevice(ev: Event) {
|
private _deleteDevice(ev: Event) {
|
||||||
const deviceId = (ev.target as any).device;
|
const deviceId = (ev.target as any).device;
|
||||||
this._devices = this._devices.filter((device) => device !== deviceId);
|
this._devices = this._devices.filter((device) => device !== deviceId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user