From 46ee3d2b26e7236644c652468c9cd8ab26683218 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Wed, 26 Mar 2025 20:52:39 +0100 Subject: [PATCH] Sort SmartThings devices to be created by parent device id (#141515) --- homeassistant/components/smartthings/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index ab7df490bd3..20325e7d3e5 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -410,7 +410,9 @@ def create_devices( rooms: dict[str, str], ) -> None: """Create devices in the device registry.""" - for device in devices.values(): + for device in sorted( + devices.values(), key=lambda d: d.device.parent_device_id or "" + ): kwargs: dict[str, Any] = {} if device.device.hub is not None: kwargs = {