@param $id

@return \a15lam\PhpWemo\Devices\WemoBulb
@throws \Exception
761666
public static function getDeviceById($id)
    {
        $device = static::lookupDevice('id', $id);
        if (!empty($device) && isset($device['class_name'])) {
            /** @var DeviceInterface $class */
            $class = $device['class_name'];
            $client = static::getClientByDevice($device);
            return new $class($id, $client);
        }

        // Search device in wemo link
        $bridge = new Bridge('wemo_link', new WemoClient($device['ip'], $device['port']));
        $devices = $bridge->getPairedDevices();

        foreach ($devices as $d) {
            if ($id === $d['id']) {
                if ($d['productName'] === 'Lighting') {
                    return new WemoBulb('wemo_link', $id);
                }
            }
        }

        throw new \Exception('Invalid device id supplied. No base device found by id ' . $id);
    }
1173686
private function load($id)
    {
        $fields = $this->getDbConnection()->fetchAssoc('SELECT * FROM `'.$this->objectDefinition->table.'` WHERE id = ?', array($id));
        if (!$fields) throw new \Exception('Object '.$this->objectDefinition->table.':'.$id.' is not found'); 
        $this->setFields($fields);
        $this->_id = $id;
        return $this;
    }
88645
public function get($id)
    {
        if (false === $this->has($id)) {
            $errMsg = sprintf('Invalid create %s', $id);
            throw new Exception\NotFoundDoctrineObjectHydratorException($errMsg);
        }

        return clone $this->prototype[$id];
    }
1006838
public function getAlarmById(int $id): AlarmInterface
    {
        $alarms = $this->getAlarms();
        foreach ($alarms as $alarm) {
            if ($alarm->getId() === $id) {
                return $alarm;
            }
        }

        throw new NotFoundException("Unable to find an alarm with the id {$id} on this network");
    }
1255303
public function load($id) {
		if (isset($this->_helpers[$id])) {
			return $this->_helpers[$id];
		}
		
		$helper = $this->loadHelper($id);
		
		if ($helper === null) {
			return;
		}
		
		if ($this->_onInit !== null) {
			$this->_onInit->__invoke($helper);
		}
		
		if ($helper instanceof LocatorAwareInterface && ! $helper->hasLocator() && $this->hasLocator()) {
			$helper->setLocator($this->getLocator());
		}
		
		$this->_helpers[$id] = $helper;
		
		return $helper;
	}
1078202
public function unlock($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->put("$this->action/$id/unlock");
    }
660655
public function getPlaylistById(string $id): PlaylistInterface
    {
        $controller = $this->getController();

        return new Playlist($id, $controller);
    }
298107
public function find($id)
    {
        if (empty($id)) {
            throw new \Exception('ID must be set');
        }

        $response = $this->restClient->get($this->endpoint . '/' . $id);

        return $response['body'];
    }
531196
public function star($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->put("$this->action/$id/star");
    }
712528
public function raw($id)
    {
        try {
            return parent::raw($id);
        } catch (UnknownIdentifierException $e) {
            throw new ContainerNotFoundException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        } catch (\Throwable $e) {
            throw new ContainerException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
846025
protected function getPathForSessionId($id)
    {
        if (is_null($this->path)) {
            throw new Exception("Path not set");
        }

        return sprintf('%s/%s%s', $this->path, $this->prefix, $id);
    }
1127626
private function load($id = null)
    {

        $this->initialize();
        $this->id = $id;

        return $this->getDataConnector()->loadResourceLink($this);

    }
1319203
public function get(int $id): Webhook
    {
        return $this->loadResource(
            Webhook::class,
            sprintf(self::GET_WEBHOOK_URI, $id)
        );
    }
876400
public function load($id)
    {

        try {
            return $this->unpersist($id);
        } catch (SessionDataNotReadableException $sdnre) {
            $this->delete($id);
        }
    }
1136553
public function get($id)
    {
        if (empty($id)) {
            throw new \Exception('cannot load object with empty id');
        }

        $params = new RequestParams(RequestOps::GET, $this->resourceMetadata, $id);
        $jsonResponse = $this->request($params);

        if ($jsonResponse == false) {
            throw new Exception('Error retrieving data');
        }

        $inst = $this->createResourceInst($jsonResponse, $this->resourceMetadata->resourceClass);

        $this->postProcess($inst);

        return $inst;
    }
346707
protected function getRowKey($id)
    {
        foreach ($this->getData() as $key => $data)
        {
            if ($data->{$this->databaseConfig->getIdentifier()} == $id)
            {
                return $key;
                break;
            }
        }
        throw new \Exception('No data found with ID: ' . $id);
    }
1101657
public static function getInstance($id)
    {
        $instance = null;

        if (array_key_exists($id, self::$instances)) {
            $instance = self::$instances[$id];
        } else {
            $instance = self::$currentInstance;
        }

        if ($instance === null) {
            throw new \Exception('No instance found for datatable, you should set a datatable id in your action with "setDatatableId" using the id from your view');
        }

        return $instance;
    }