diff --git a/src/panels/config/hardware/ha-config-hardware.ts b/src/panels/config/hardware/ha-config-hardware.ts index 3e19697d1e..2d225bca1c 100644 --- a/src/panels/config/hardware/ha-config-hardware.ts +++ b/src/panels/config/hardware/ha-config-hardware.ts @@ -80,29 +80,31 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { private _cpuEntries: { x: number; y: number | null }[] = []; public hassSubscribe() { - return [ - this.hass.connection.subscribeMessage( - (message) => { - // Only store the last 60 entries - this._memoryEntries.shift(); - this._cpuEntries.shift(); + return isComponentLoaded(this.hass, "hardware") + ? [ + this.hass.connection.subscribeMessage( + (message) => { + // Only store the last 60 entries + this._memoryEntries.shift(); + this._cpuEntries.shift(); - this._memoryEntries.push({ - x: new Date(message.timestamp).getTime(), - y: message.memory_used_percent, - }); - this._cpuEntries.push({ - x: new Date(message.timestamp).getTime(), - y: message.cpu_percent, - }); + this._memoryEntries.push({ + x: new Date(message.timestamp).getTime(), + y: message.memory_used_percent, + }); + this._cpuEntries.push({ + x: new Date(message.timestamp).getTime(), + y: message.cpu_percent, + }); - this._systemStatusData = message; - }, - { - type: "hardware/subscribe_system_status", - } - ), - ]; + this._systemStatusData = message; + }, + { + type: "hardware/subscribe_system_status", + } + ), + ] + : []; } protected willUpdate(): void { @@ -198,32 +200,34 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { .narrow=${this.narrow} .header=${this.hass.localize("ui.panel.config.hardware.caption")} > - - - ${this.hass.localize( - "ui.panel.config.hardware.available_hardware.title" - )} - ${this._hostData - ? html` - ${this.hass.localize( - "ui.panel.config.hardware.reboot_host" - )} - ${this.hass.localize( - "ui.panel.config.hardware.shutdown_host" - )} - ` - : ""} - + ${isComponentLoaded(this.hass, "hassio") + ? html` + + ${this.hass.localize( + "ui.panel.config.hardware.available_hardware.title" + )} + ${this._hostData + ? html` + ${this.hass.localize( + "ui.panel.config.hardware.reboot_host" + )} + ${this.hass.localize( + "ui.panel.config.hardware.shutdown_host" + )} + ` + : ""} + ` + : ""} ${this._error ? html`