function findDeviceRecursively(parentDevice, path) {
  if (path.length === 0) {
    return parentDevice;
  }

  const [currentNumber, ...remainingPath] = path;

  // If this is a child_endpoint marker, skip to next number
  if (currentNumber === 'child_endpoint') {
    return findDeviceRecursively(parentDevice, remainingPath);
  }

  const deviceNumber = Number(currentNumber);

  // Look in child endpoints
  if (parentDevice.childEndpoints) {
    const childDevice = parentDevice.childEndpoints.find((child) => child.number === deviceNumber);
    if (childDevice) {
      return findDeviceRecursively(childDevice, remainingPath);
    }
  }

  return null;
}
@description Find a device recursively through child endpoints.
@param {object} parentDevice - The parent device to search in.
@param {string[]} path - Array of device numbers to follow.
@returns {object|null} - The found device or null.
@example
const targetDevice = findDeviceRecursively(rootDevice, devicePath.slice(1));