diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 15d71e694f..f5beadea90 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -223,7 +223,8 @@ export class MoreInfoDialog extends LitElement { private _computeShowHistoryComponent(entityId) { return ( - isComponentLoaded(this.hass, "history") && + (isComponentLoaded(this.hass, "history") || + isComponentLoaded(this.hass, "logbook")) && !DOMAINS_MORE_INFO_NO_HISTORY.includes(computeDomain(entityId)) ); } diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index c75181a1b4..f436a9ddab 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -8,6 +8,7 @@ import { PropertyValues, TemplateResult, } from "lit-element"; +import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import "../../components/ha-circular-progress"; import "../../components/state-history-charts"; @@ -42,13 +43,16 @@ export class MoreInfoHistory extends LitElement { return html``; } - return html` - ${!this._entries + return html`${isComponentLoaded(this.hass, "history") + ? html`` + : ""} + ${isComponentLoaded(this.hass, "logbook") + ? !this._entries ? html` ${this.hass.localize("ui.components.logbook.entries_not_found")} - `}`; + ` + : ""} `; } protected firstUpdated(): void { @@ -97,6 +102,9 @@ export class MoreInfoHistory extends LitElement { } private async _getStateHistory(): Promise { + if (!isComponentLoaded(this.hass, "history")) { + return; + } this._stateHistory = await getRecentWithCache( this.hass!, this.entityId, @@ -111,6 +119,9 @@ export class MoreInfoHistory extends LitElement { } private async _getLogBookData() { + if (!isComponentLoaded(this.hass, "logbook")) { + return; + } const yesterday = new Date(new Date().getTime() - 24 * 60 * 60 * 1000); const now = new Date(); this._entries = await getLogbookData(