Scenes: Fix entity picked from device doesn't add device (#6343)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Bram Kragten 2020-07-09 13:48:28 +02:00 committed by GitHub
parent 58ffc2c6ca
commit e71dd7409e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -532,6 +532,18 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
} }
this._entities = [...this._entities, entityId]; this._entities = [...this._entities, entityId];
this._storeState(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._dirty = true; this._dirty = true;
} }