mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
fix loading groups (#4727)
This commit is contained in:
parent
3fdcc1c0ea
commit
cbe4782d78
@ -44,23 +44,6 @@ export class ZHADevicePage extends LitElement {
|
||||
@property() private _bindableDevices: ZHADevice[] = [];
|
||||
@property() private _groups: ZHAGroup[] = [];
|
||||
|
||||
private _firstUpdatedCalled: boolean = false;
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
if (this.hass && this._firstUpdatedCalled) {
|
||||
this._fetchGroups();
|
||||
}
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues): void {
|
||||
super.firstUpdated(changedProperties);
|
||||
if (this.hass) {
|
||||
this._fetchGroups();
|
||||
}
|
||||
this._firstUpdatedCalled = true;
|
||||
}
|
||||
|
||||
protected updated(changedProperties: PropertyValues): void {
|
||||
if (changedProperties.has("ieee")) {
|
||||
this._fetchData();
|
||||
@ -148,16 +131,10 @@ export class ZHADevicePage extends LitElement {
|
||||
sortZHADevices
|
||||
)
|
||||
: [];
|
||||
this._groups = (await fetchGroups(this.hass!)).sort(sortZHAGroups);
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchGroups() {
|
||||
this._groups =
|
||||
this.device && this.device.device_type !== "Coordinator"
|
||||
? (await fetchGroups(this.hass!)).sort(sortZHAGroups)
|
||||
: [];
|
||||
}
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return [
|
||||
haStyle,
|
||||
|
Loading…
x
Reference in New Issue
Block a user