From 3e2fb09251c201d64ccb428a7b99feb90af52129 Mon Sep 17 00:00:00 2001 From: "David F. Mulcahey" Date: Mon, 21 Nov 2022 15:20:58 -0500 Subject: [PATCH] Clean up the ZHA pairing UI (#14287) --- .../zha/zha-add-devices-page.ts | 13 +++++++-- .../integration-panels/zha/zha-device-card.ts | 28 +++++++++++-------- .../zha/zha-device-pairing-status-card.ts | 7 +++++ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts index 0b64806fdf..31d30b88fd 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts @@ -190,12 +190,19 @@ class ZHAAddDevicesPage extends LitElement { } } + private _deactivate(): void { + this._active = false; + if (this._addDevicesTimeoutHandle) { + clearTimeout(this._addDevicesTimeoutHandle); + } + } + private _subscribe(): void { if (!this.hass) { return; } this._active = true; - const data: any = { type: "zha/devices/permit" }; + const data: any = { type: "zha/devices/permit", duration: 254 }; if (this._ieeeAddress) { data.ieee = this._ieeeAddress; } @@ -204,8 +211,8 @@ class ZHAAddDevicesPage extends LitElement { data ); this._addDevicesTimeoutHandle = setTimeout( - () => this._unsubscribe(), - 120000 + () => this._deactivate(), + 254000 ); } diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index 95ec52187c..f357a9bdf9 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -73,9 +73,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) { ); return html` - +
-
+
${this.device.model}
${this.hass.localize( @@ -87,15 +87,17 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) {
- ${entities.map( - (entity) => html` - - ` + ${entities.map((entity) => + !entity.disabled_by + ? html` + + ` + : "" )}