mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +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)) {
|
||||
return;
|
||||
}
|
||||
this._entities = [...this._entities, entityId];
|
||||
this._storeState(entityId);
|
||||
|
||||
const entityRegistry = this._entityRegistryEntries.find(
|
||||
(entityReg) => entityReg.entity_id === entityId
|
||||
);
|
||||
|
||||
if (
|
||||
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;
|
||||
}
|
||||
|
||||
@ -582,14 +580,12 @@ export class HaSceneEditor extends SubscribeMixin(
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
private _devicePicked(ev: CustomEvent) {
|
||||
const device = ev.detail.value;
|
||||
(ev.target as any).value = "";
|
||||
if (this._devices.includes(device)) {
|
||||
private _pickDevice(device_id: string) {
|
||||
if (this._devices.includes(device_id)) {
|
||||
return;
|
||||
}
|
||||
this._devices = [...this._devices, device];
|
||||
const deviceEntities = this._deviceEntityLookup[device];
|
||||
this._devices = [...this._devices, device_id];
|
||||
const deviceEntities = this._deviceEntityLookup[device_id];
|
||||
if (!deviceEntities) {
|
||||
return;
|
||||
}
|
||||
@ -600,6 +596,12 @@ export class HaSceneEditor extends SubscribeMixin(
|
||||
this._dirty = true;
|
||||
}
|
||||
|
||||
private _devicePicked(ev: CustomEvent) {
|
||||
const device = ev.detail.value;
|
||||
(ev.target as any).value = "";
|
||||
this._pickDevice(device);
|
||||
}
|
||||
|
||||
private _deleteDevice(ev: Event) {
|
||||
const deviceId = (ev.target as any).device;
|
||||
this._devices = this._devices.filter((device) => device !== deviceId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user