From bfb0a961cd05f61d732437fcfb06828f54a059e5 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 22 Jun 2022 20:55:19 +0200 Subject: [PATCH] Add chidlren to the HW output (#3690) --- supervisor/api/const.py | 6 ++++++ supervisor/api/hardware.py | 6 ++++-- supervisor/hardware/const.py | 6 ------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/supervisor/api/const.py b/supervisor/api/const.py index c263b5164..ab7817e2b 100644 --- a/supervisor/api/const.py +++ b/supervisor/api/const.py @@ -31,3 +31,9 @@ ATTR_SIGNED = "signed" ATTR_STARTUP_TIME = "startup_time" ATTR_UPDATE_TYPE = "update_type" ATTR_USE_NTP = "use_ntp" +ATTR_BY_ID = "by_id" +ATTR_SUBSYSTEM = "subsystem" +ATTR_SYSFS = "sysfs" +ATTR_DEV_PATH = "dev_path" +ATTR_ATTRIBUTES = "attributes" +ATTR_CHILDREN = "children" diff --git a/supervisor/api/hardware.py b/supervisor/api/hardware.py index 376bdfd36..89b50b0d0 100644 --- a/supervisor/api/hardware.py +++ b/supervisor/api/hardware.py @@ -6,14 +6,15 @@ from aiohttp import web from ..const import ATTR_AUDIO, ATTR_DEVICES, ATTR_INPUT, ATTR_NAME, ATTR_OUTPUT from ..coresys import CoreSysAttributes -from ..hardware.const import ( +from ..hardware.data import Device +from .const import ( ATTR_ATTRIBUTES, ATTR_BY_ID, + ATTR_CHILDREN, ATTR_DEV_PATH, ATTR_SUBSYSTEM, ATTR_SYSFS, ) -from ..hardware.data import Device from .utils import api_process _LOGGER: logging.Logger = logging.getLogger(__name__) @@ -28,6 +29,7 @@ def device_struct(device: Device) -> dict[str, Any]: ATTR_SUBSYSTEM: device.subsystem, ATTR_BY_ID: device.by_id, ATTR_ATTRIBUTES: device.attributes, + ATTR_CHILDREN: device.children, } diff --git a/supervisor/hardware/const.py b/supervisor/hardware/const.py index 188514424..8975657b2 100644 --- a/supervisor/hardware/const.py +++ b/supervisor/hardware/const.py @@ -1,12 +1,6 @@ """Constants for hardware.""" from enum import Enum -ATTR_BY_ID = "by_id" -ATTR_SUBSYSTEM = "subsystem" -ATTR_SYSFS = "sysfs" -ATTR_DEV_PATH = "dev_path" -ATTR_ATTRIBUTES = "attributes" - class UdevSubsystem(str, Enum): """Udev subsystem class."""