public void TryFindChildren() { if (Root == 0) { return; } IHSApplication hs = _plugin.hs; DeviceClass root = (DeviceClass)hs.GetDeviceByRef(Root); foreach (int childRef in root.get_AssociatedDevices(hs)) { DeviceClass child = (DeviceClass)hs.GetDeviceByRef(childRef); SubDeviceType subType = (SubDeviceType)int.Parse(child.get_Address(hs).Split('-')[1]); switch (subType) { case SubDeviceType.Brightness: Brightness = childRef; break; case SubDeviceType.Color: Color = childRef; break; case SubDeviceType.Temperature: Temperature = childRef; break; } } }