Check if logbook component loaded when fetching trace (#8861)

This commit is contained in:
Bram Kragten 2021-04-08 18:04:08 +02:00
parent 716335df2c
commit e4606219bc
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B

View File

@ -40,6 +40,7 @@ import {
mdiDownload,
} from "@mdi/js";
import "./ha-automation-trace-blueprint-config";
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
@customElement("ha-automation-trace")
export class HaAutomationTrace extends LitElement {
@ -378,11 +379,13 @@ export class HaAutomationTrace extends LitElement {
this.automationId,
this._runId!
);
this._logbookEntries = await getLogbookDataForContext(
this.hass,
trace.timestamp.start,
trace.context.id
);
this._logbookEntries = isComponentLoaded(this.hass, "logbook")
? await getLogbookDataForContext(
this.hass,
trace.timestamp.start,
trace.context.id
)
: [];
this._trace = trace;
}