mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix device selector when picking devices with no entities (#16734)
This commit is contained in:
parent
27451ca30e
commit
b1f5ff26d9
@ -77,7 +77,9 @@ export class HaDeviceSelector extends LitElement {
|
|||||||
.label=${this.label}
|
.label=${this.label}
|
||||||
.helper=${this.helper}
|
.helper=${this.helper}
|
||||||
.deviceFilter=${this._filterDevices}
|
.deviceFilter=${this._filterDevices}
|
||||||
.entityFilter=${this._filterEntities}
|
.entityFilter=${this.selector.device?.entity
|
||||||
|
? this._filterEntities
|
||||||
|
: undefined}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.required=${this.required}
|
.required=${this.required}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
@ -92,7 +94,9 @@ export class HaDeviceSelector extends LitElement {
|
|||||||
.value=${this.value}
|
.value=${this.value}
|
||||||
.helper=${this.helper}
|
.helper=${this.helper}
|
||||||
.deviceFilter=${this._filterDevices}
|
.deviceFilter=${this._filterDevices}
|
||||||
.entityFilter=${this._filterEntities}
|
.entityFilter=${this.selector.device?.entity
|
||||||
|
? this._filterEntities
|
||||||
|
: undefined}
|
||||||
.disabled=${this.disabled}
|
.disabled=${this.disabled}
|
||||||
.required=${this.required}
|
.required=${this.required}
|
||||||
></ha-devices-picker>
|
></ha-devices-picker>
|
||||||
@ -115,14 +119,10 @@ export class HaDeviceSelector extends LitElement {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _filterEntities = (entity: HassEntity): boolean => {
|
private _filterEntities = (entity: HassEntity): boolean =>
|
||||||
if (!this.selector.device?.entity) {
|
ensureArray(this.selector.device!.entity).some((filter) =>
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return ensureArray(this.selector.device.entity).some((filter) =>
|
|
||||||
filterSelectorEntities(filter, entity, this._entitySources)
|
filterSelectorEntities(filter, entity, this._entitySources)
|
||||||
);
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user