Guard more of the hardware panel (#13650)

This commit is contained in:
Joakim Sørensen 2022-09-08 02:59:08 +02:00 committed by Bram Kragten
parent c5428d8581
commit 5e431a07ad
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B

View File

@ -80,7 +80,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
private _cpuEntries: { x: number; y: number | null }[] = [];
public hassSubscribe() {
return [
return isComponentLoaded(this.hass, "hardware")
? [
this.hass.connection.subscribeMessage<SystemStatusStreamMessage>(
(message) => {
// Only store the last 60 entries
@ -102,7 +103,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
type: "hardware/subscribe_system_status",
}
),
];
]
: [];
}
protected willUpdate(): void {
@ -198,7 +200,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
.narrow=${this.narrow}
.header=${this.hass.localize("ui.panel.config.hardware.caption")}
>
<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon">
${isComponentLoaded(this.hass, "hassio")
? html`<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon">
<ha-icon-button
.label=${this.hass.localize("ui.common.menu")}
.path=${mdiDotsVertical}
@ -223,7 +226,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
>
`
: ""}
</ha-button-menu>
</ha-button-menu>`
: ""}
${this._error
? html`
<ha-alert alert-type="error"