mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Use Hardware Integration for System Menu (#12789)
This commit is contained in:
parent
d0ead1fdb8
commit
10813d06b6
@ -8,7 +8,7 @@ import "../../../components/ha-navigation-list";
|
||||
import "../../../components/ha-tip";
|
||||
import { BackupContent, fetchBackupInfo } from "../../../data/backup";
|
||||
import { CloudStatus, fetchCloudStatus } from "../../../data/cloud";
|
||||
import { BOARD_NAMES } from "../../../data/hardware";
|
||||
import { BOARD_NAMES, HardwareInfo } from "../../../data/hardware";
|
||||
import { fetchHassioBackups, HassioBackup } from "../../../data/hassio/backup";
|
||||
import {
|
||||
fetchHassioHassOsInfo,
|
||||
@ -156,8 +156,8 @@ class HaConfigSystemNavigation extends LitElement {
|
||||
this._fetchNetworkStatus();
|
||||
const isHassioLoaded = isComponentLoaded(this.hass, "hassio");
|
||||
this._fetchBackupInfo(isHassioLoaded);
|
||||
this._fetchHardwareInfo(isHassioLoaded);
|
||||
if (isHassioLoaded) {
|
||||
this._fetchHardwareInfo();
|
||||
this._fetchStorageInfo();
|
||||
}
|
||||
}
|
||||
@ -202,10 +202,17 @@ class HaConfigSystemNavigation extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchHardwareInfo() {
|
||||
const osData: HassioHassOSInfo = await fetchHassioHassOsInfo(this.hass);
|
||||
if (osData.board) {
|
||||
this._boardName = BOARD_NAMES[osData.board];
|
||||
private async _fetchHardwareInfo(isHassioLoaded: boolean) {
|
||||
if (isComponentLoaded(this.hass, "hardware")) {
|
||||
const hardwareInfo: HardwareInfo = await this.hass.callWS({
|
||||
type: "hardware/info",
|
||||
});
|
||||
this._boardName = hardwareInfo?.hardware?.[0].name;
|
||||
} else if (isHassioLoaded) {
|
||||
const osData: HassioHassOSInfo = await fetchHassioHassOsInfo(this.hass);
|
||||
if (osData.board) {
|
||||
this._boardName = BOARD_NAMES[osData.board];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user