Only link the parent device if known in SmartThings (#141719)

Only link the parent device if we know the parent device
This commit is contained in:
Joost Lekkerkerker 2025-03-29 10:18:27 +01:00 committed by Franck Nijhof
parent e77a1b12f7
commit 1244fc4682
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -426,7 +426,7 @@ def create_devices(
kwargs[ATTR_CONNECTIONS] = { kwargs[ATTR_CONNECTIONS] = {
(dr.CONNECTION_NETWORK_MAC, device.device.hub.mac_address) (dr.CONNECTION_NETWORK_MAC, device.device.hub.mac_address)
} }
if device.device.parent_device_id: if device.device.parent_device_id and device.device.parent_device_id in devices:
kwargs[ATTR_VIA_DEVICE] = (DOMAIN, device.device.parent_device_id) kwargs[ATTR_VIA_DEVICE] = (DOMAIN, device.device.parent_device_id)
if (ocf := device.device.ocf) is not None: if (ocf := device.device.ocf) is not None:
kwargs.update( kwargs.update(