Return a list of battery levels of all cameras.
431037
def get_cameras_battery_level(self):
        """"""
        battery_levels = {}
        if not self.camera_properties:
            return None

        for camera in self.camera_properties:
            serialnum = camera.get('serialNumber')
            cam_battery = camera.get('batteryLevel')
            battery_levels[serialnum] = cam_battery
        return battery_levels
820730
def attributes(self):
        """"""
        attributes = {
            'name': self.name,
            'camera_id': self.camera_id,
            'serial': self.serial,
            'temperature': self.temperature,
            'temperature_c': self.temperature_c,
            'temperature_calibrated': self.temperature_calibrated,
            'battery': self.battery,
            'thumbnail': self.thumbnail,
            'video': self.clip,
            'motion_enabled': self.motion_enabled,
            'motion_detected': self.motion_detected,
            'wifi_strength': self.wifi_strength,
            'network_id': self.sync.network_id,
            'sync_module': self.sync.name,
            'last_record': self.last_record
        }
        return attributes
385138
def update(self):
        """"""
        if batinfo_tag:
            # Use the batinfo lib to grab the stats
            # Compatible with multiple batteries
            self.bat.update()
            self.bat_list = [{
                'label': 'Battery',
                'value': self.battery_percent,
                'unit': '%'}]
        elif psutil_tag and hasattr(self.bat.sensors_battery(), 'percent'):
            # Use psutil to grab the stats
            # Give directly the battery percent
            self.bat_list = [{
                'label': 'Battery',
                'value': int(self.bat.sensors_battery().percent),
                'unit': '%'}]
        else:
            # No stats...
            self.bat_list = []
655658
def get_battery_state():
        
        energy_now = float(100.0)
        power_now = float(100.0)
        energy_full = float(100.0)
        return energy_full, energy_now, power_now
544622
def camera_position(self):
        
        return [self.camera.GetPosition(),
                self.camera.GetFocalPoint(),
                self.camera.GetViewUp()]
755962
def get_monitors(self) -> List[Monitor]:
        """"""
        raw_monitors = self._zm_request('get', ZoneMinder.MONITOR_URL)
        if not raw_monitors:
            _LOGGER.warning("Could not fetch monitors from ZoneMinder")
            return []

        monitors = []
        for raw_result in raw_monitors['monitors']:
            _LOGGER.debug("Initializing camera %s",
                          raw_result['Monitor']['Id'])
            monitors.append(Monitor(self, raw_result))

        return monitors
669247
def _getphotosets_forphoto(self,pid):
        """"""

        resp=self.flickr.photos_getAllContexts(photo_id=pid)
        if resp.attrib['stat']!='ok':
            logger.error("%s - flickr: photos_getAllContext failed with status: %s",\
                    resp.attrib['stat']);
            return None

        lphotosets=[]
        for element in resp.findall('set'):
            lphotosets.append(element.attrib['title'])

        logger.debug('%s - belongs to these photosets %s',pid,lphotosets)

        return lphotosets
1151708
def all(self, res):
        ""
        B = get_backend()
        return B.get_objects(B.get_concrete(res))
1187070
def lights(self):
        """"""
        return [Light(self._device, i) for i in range(len(self.raw))]
887867
def getSystemIps():
        
        IPs = []
        for interface in NetInfo.getSystemIfs():
            if not interface.startswith('lo'):
                ip = netinfo.get_ip(interface)
                IPs.append(ip)
        return IPs
230203
def getDevices(self, status=None):
        
        return [d for d in self.devices.values() if status is None or d.payload.get('status') == status]
258794
def device_status(self):
        """"""
        return {
            'active': self.device['active'],
            'offline': self.device['offline'],
            'last_update': self.last_update,
            'battery_level': self.battery_level,
        }
1027236
def get_camera_info(self, camera_id):
        """"""
        response = api.request_camera_info(self.blink,
                                           self.network_id,
                                           camera_id)
        try:
            return response['camera'][0]
        except (TypeError, KeyError):
            _LOGGER.error("Could not extract camera info: %s",
                          response,
                          exc_info=True)
            return []
898535
def _get_camera_properties(self):
        """"""
        if self.base_station and self.base_station.camera_properties:
            for cam in self.base_station.camera_properties:
                if cam["serialNumber"] == self.device_id:
                    return cam
        return None
635196
def _item_sources(self):
        """"""
        return [self.data_vars, self.coords, {d: self[d] for d in self.dims},
                LevelCoordinatesSource(self)]
360440
def battery(self):
        
        if self._voltage is None or self._current is None or self._level is None:
            return None
        return Battery(self._voltage, self._current, self._level)
228191
def directories(self):
        
        dirlist_p = new_gp_object("CameraList")
        lib.gp_camera_folder_list_folders(self._cam._cam, self.path.encode(),
                                          dirlist_p, self._cam._ctx)
        for idx in range(lib.gp_list_count(dirlist_p)):
            name = os.path.join(
                self.path, get_string(lib.gp_list_get_name, dirlist_p, idx))
            yield Directory(name=name, parent=self, camera=self._cam)
        lib.gp_list_free(dirlist_p)