From 4fba9c3c0a0f780f01f24ecfd7ca0e052d2b920b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 9 May 2025 04:23:52 -0400 Subject: [PATCH] Add installation method to the about page (#25378) Co-authored-by: Bram Kragten Co-authored-by: Franck Nijhof --- src/data/system_health.ts | 26 +++++++++++++++---- src/panels/config/info/ha-config-info.ts | 18 +++++++++++++ .../repairs/dialog-system-information.ts | 4 +-- src/translations/en.json | 1 + 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/data/system_health.ts b/src/data/system_health.ts index 60bdc21337..d8fb40c924 100644 --- a/src/data/system_health.ts +++ b/src/data/system_health.ts @@ -26,13 +26,29 @@ export type SystemCheckValue = | boolean | SystemCheckValueObject; -export type SystemHealthInfo = Record< - string, - { +export type SystemHealthInfo = Partial<{ + homeassistant: { + info: { + version: string; + installation_type: string; + dev: boolean; + hassio: boolean; + docker: boolean; + user: string; + virtualenv: boolean; + python_version: string; + os_name: string; + os_version: string; + arch: string; + timezone: string; + config_dir: string; + }; + }; + [domain: string]: { manage_url?: string; info: Record; - } ->; + }; +}>; interface SystemHealthEventInitial { type: "initial"; diff --git a/src/panels/config/info/ha-config-info.ts b/src/panels/config/info/ha-config-info.ts index ef99715e4e..b231dd56e6 100644 --- a/src/panels/config/info/ha-config-info.ts +++ b/src/panels/config/info/ha-config-info.ts @@ -29,6 +29,7 @@ import { mdiHomeAssistant } from "../../../resources/home-assistant-logo-svg"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant, Route } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; +import { subscribeSystemHealthInfo } from "../../../data/system_health"; const JS_TYPE = __BUILD__; const JS_VERSION = __VERSION__; @@ -99,6 +100,8 @@ class HaConfigInfo extends LitElement { @state() private _hassioInfo?: HassioInfo; + @state() private _installationMethod?: string; + protected render(): TemplateResult { const hass = this.hass; const customUiList: { name: string; url: string; version: string }[] = @@ -127,6 +130,14 @@ class HaConfigInfo extends LitElement {

Home Assistant

    +
  • + ${this.hass.localize( + `ui.panel.config.info.installation_method` + )} + ${this._installationMethod || "…"} +
  • Core ${hass.connection.haVersion} @@ -249,6 +260,13 @@ class HaConfigInfo extends LitElement { if (isComponentLoaded(this.hass, "hassio")) { this._loadSupervisorInfo(); } + + const unsubSystemHealth = subscribeSystemHealthInfo(this.hass, (info) => { + if (info?.homeassistant) { + this._installationMethod = info.homeassistant.info.installation_type; + unsubSystemHealth.then((unsub) => unsub()); + } + }); } private async _loadSupervisorInfo(): Promise { diff --git a/src/panels/config/repairs/dialog-system-information.ts b/src/panels/config/repairs/dialog-system-information.ts index b9666b0c57..a556d96ce9 100644 --- a/src/panels/config/repairs/dialog-system-information.ts +++ b/src/panels/config/repairs/dialog-system-information.ts @@ -301,7 +301,7 @@ class DialogSystemInformation extends LitElement { } else { const domains = Object.keys(this._systemInfo).sort(sortKeys); for (const domain of domains) { - const domainInfo = this._systemInfo[domain]; + const domainInfo = this._systemInfo[domain]!; const keys: TemplateResult[] = []; for (const key of Object.keys(domainInfo.info)) { @@ -387,7 +387,7 @@ class DialogSystemInformation extends LitElement { const domainParts: string[] = []; for (const domain of Object.keys(this._systemInfo!).sort(sortKeys)) { - const domainInfo = this._systemInfo![domain]; + const domainInfo = this._systemInfo![domain]!; let first = true; const parts = [ `${ diff --git a/src/translations/en.json b/src/translations/en.json index 04cf11e6cc..cdd7011e6b 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3111,6 +3111,7 @@ }, "info": { "caption": "About", + "installation_method": "Installation method", "copy_menu": "Copy menu", "copy_raw": "Raw text", "copy_github": "For GitHub",