diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts index 2ea210a1a9..095696f8a5 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts @@ -75,18 +75,21 @@ class ZHAConfigDashboard extends LitElement { } protected render(): TemplateResult { - const deviceIds = new Set(); + const devices = this._configEntry + ? Object.values(this.hass.devices).filter((device) => + device.config_entries.includes(this._configEntry!.entry_id) + ) + : []; + const deviceCount = devices.length; + let entityCount = 0; for (const entity of Object.values(this.hass.entities)) { if (entity.platform === "zha") { entityCount++; - if (entity.device_id) { - deviceIds.add(entity.device_id); - } } } const deviceOnline = - this._offlineDevices < deviceIds.size || deviceIds.size === 0; + this._offlineDevices < deviceCount || deviceCount === 0; return html`
- ${this._renderNetworkStatus(deviceOnline, deviceIds.size)} - ${this._renderMyNetworkCard(deviceIds, entityCount)} + ${this._renderNetworkStatus(deviceOnline, deviceCount)} + ${this._renderMyNetworkCard(deviceCount, entityCount)} ${this._renderNavigationCard()} ${this._renderBackupCard()}
@@ -165,7 +168,7 @@ class ZHAConfigDashboard extends LitElement { `; } - private _renderMyNetworkCard(deviceIds: Set, entityCount: number) { + private _renderMyNetworkCard(deviceCount: number, entityCount: number) { return html`
@@ -189,7 +192,7 @@ class ZHAConfigDashboard extends LitElement {
${this.hass.localize( "ui.panel.config.zha.configuration_page.device_count", - { count: deviceIds.size } + { count: deviceCount } )}