From 3d026b95348806ebadc333149238a51b68383783 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Mon, 16 Jun 2025 20:14:13 +0200 Subject: [PATCH] Expose machine ID (#5953) Expose the unique machine ID of the local system via the Supervisor API. This allows to identify a particular machine across reboots, backup restores and updates. The machine ID is a stable identifier that does not change unless the underlying hardware is changed or the operating system is reinstalled. --- supervisor/api/root.py | 2 ++ supervisor/const.py | 1 + supervisor/coresys.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/supervisor/api/root.py b/supervisor/api/root.py index 00a9d0c1a..3054f77fd 100644 --- a/supervisor/api/root.py +++ b/supervisor/api/root.py @@ -17,6 +17,7 @@ from ..const import ( ATTR_ICON, ATTR_LOGGING, ATTR_MACHINE, + ATTR_MACHINE_ID, ATTR_NAME, ATTR_OPERATING_SYSTEM, ATTR_STATE, @@ -48,6 +49,7 @@ class APIRoot(CoreSysAttributes): ATTR_OPERATING_SYSTEM: self.sys_host.info.operating_system, ATTR_FEATURES: self.sys_host.features, ATTR_MACHINE: self.sys_machine, + ATTR_MACHINE_ID: self.sys_machine_id, ATTR_ARCH: self.sys_arch.default, ATTR_STATE: self.sys_core.state, ATTR_SUPPORTED_ARCH: self.sys_arch.supported, diff --git a/supervisor/const.py b/supervisor/const.py index e62f78204..bde3e9135 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -246,6 +246,7 @@ ATTR_LOGO = "logo" ATTR_LONG_DESCRIPTION = "long_description" ATTR_MAC = "mac" ATTR_MACHINE = "machine" +ATTR_MACHINE_ID = "machine_id" ATTR_MAINTAINER = "maintainer" ATTR_MAP = "map" ATTR_MEMORY_LIMIT = "memory_limit" diff --git a/supervisor/coresys.py b/supervisor/coresys.py index f69a3e82a..49cc5264e 100644 --- a/supervisor/coresys.py +++ b/supervisor/coresys.py @@ -673,7 +673,7 @@ class CoreSysAttributes: @property def sys_machine_id(self) -> str | None: - """Return machine id.""" + """Return machine ID.""" return self.coresys.machine_id @property