From e3b797e85c72a5321c8058435d7509fed0418b15 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 10:29:19 +0100 Subject: [PATCH] Fix more info for disabled entity (#15641) --- src/dialogs/more-info/ha-more-info-dialog.ts | 5 +++-- src/dialogs/more-info/ha-more-info-info.ts | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 38a7e4ab84..ced7e56e0e 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -214,7 +214,7 @@ export class MoreInfoDialog extends LitElement { return null; } const entityId = this._entityId; - const stateObj = this.hass.states[entityId]; + const stateObj = this.hass.states[entityId] as HassEntity | undefined; const domain = computeDomain(entityId); const name = (stateObj && computeStateName(stateObj)) || entityId; @@ -226,6 +226,7 @@ export class MoreInfoDialog extends LitElement { const title = this._childView?.viewTitle ?? name; const isInfoView = this._currView === "info" && !this._childView; + const isNewMoreInfo = stateObj && computeShowNewMoreInfo(stateObj); return html` @@ -251,7 +252,7 @@ export class MoreInfoDialog extends LitElement { )} > `} - ${!isInfoView || !computeShowNewMoreInfo(stateObj) + ${!isInfoView || !isNewMoreInfo ? html`
@@ -46,7 +47,7 @@ export class MoreInfoInfo extends LitElement { ` : ""}
- ${DOMAINS_NO_INFO.includes(domain) || computeShowNewMoreInfo(stateObj) + ${DOMAINS_NO_INFO.includes(domain) || isNewMoreInfo ? "" : html` `}