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.
This commit is contained in:
Stefan Agner 2025-06-16 20:14:13 +02:00 committed by GitHub
parent 0e8ace949a
commit 3d026b9534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,7 @@ from ..const import (
ATTR_ICON, ATTR_ICON,
ATTR_LOGGING, ATTR_LOGGING,
ATTR_MACHINE, ATTR_MACHINE,
ATTR_MACHINE_ID,
ATTR_NAME, ATTR_NAME,
ATTR_OPERATING_SYSTEM, ATTR_OPERATING_SYSTEM,
ATTR_STATE, ATTR_STATE,
@ -48,6 +49,7 @@ class APIRoot(CoreSysAttributes):
ATTR_OPERATING_SYSTEM: self.sys_host.info.operating_system, ATTR_OPERATING_SYSTEM: self.sys_host.info.operating_system,
ATTR_FEATURES: self.sys_host.features, ATTR_FEATURES: self.sys_host.features,
ATTR_MACHINE: self.sys_machine, ATTR_MACHINE: self.sys_machine,
ATTR_MACHINE_ID: self.sys_machine_id,
ATTR_ARCH: self.sys_arch.default, ATTR_ARCH: self.sys_arch.default,
ATTR_STATE: self.sys_core.state, ATTR_STATE: self.sys_core.state,
ATTR_SUPPORTED_ARCH: self.sys_arch.supported, ATTR_SUPPORTED_ARCH: self.sys_arch.supported,

View File

@ -246,6 +246,7 @@ ATTR_LOGO = "logo"
ATTR_LONG_DESCRIPTION = "long_description" ATTR_LONG_DESCRIPTION = "long_description"
ATTR_MAC = "mac" ATTR_MAC = "mac"
ATTR_MACHINE = "machine" ATTR_MACHINE = "machine"
ATTR_MACHINE_ID = "machine_id"
ATTR_MAINTAINER = "maintainer" ATTR_MAINTAINER = "maintainer"
ATTR_MAP = "map" ATTR_MAP = "map"
ATTR_MEMORY_LIMIT = "memory_limit" ATTR_MEMORY_LIMIT = "memory_limit"

View File

@ -673,7 +673,7 @@ class CoreSysAttributes:
@property @property
def sys_machine_id(self) -> str | None: def sys_machine_id(self) -> str | None:
"""Return machine id.""" """Return machine ID."""
return self.coresys.machine_id return self.coresys.machine_id
@property @property