(self)
Create camera list for onboarded networks.
Create camera list for onboarded networks.
Create camera list for onboarded networks .
def setup_camera_list(self):
        """Create camera list for onboarded networks."""
        all_cameras = {}
        response = api.request_camera_usage(self)
        try:
            for network in response["networks"]:
                camera_network = str(network["network_id"])
                if camera_network not in all_cameras:
                    all_cameras[camera_network] = []
                for camera in network["cameras"]:
                    all_cameras[camera_network].append(
                        {"name": camera["name"], "id": camera["id"]}
                    )
            mini_cameras = self.setup_owls()
            lotus_cameras = self.setup_lotus()
            for camera in mini_cameras:
                for network, camera_info in camera.items():
                    all_cameras[network].append(camera_info)
            for camera in lotus_cameras:
                for network, camera_info in camera.items():
                    all_cameras[network].append(camera_info)
            return all_cameras
        except (KeyError, TypeError):
            _LOGGER.error("Unable to retrieve cameras from response %s", response)
            raise BlinkSetupError
def setup_camera_list ( self ) : all_cameras = { } response = api . request_camera_usage ( self ) try : for network in response [ "networks" ] : camera_network = str ( network [ "network_id" ] ) if camera_network not in all_cameras : all_cameras [ camera_network ] = [ ] for camera in network [ "cameras" ] : all_cameras [ camera_network ] . append ( { "name" : camera [ "name" ] , "id" : camera [ "id" ] } ) mini_cameras = self . setup_owls ( ) lotus_cameras = self . setup_lotus ( ) for camera in mini_cameras : for network , camera_info in camera . items ( ) : all_cameras [ network ] . append ( camera_info ) for camera in lotus_cameras : for network , camera_info in camera . items ( ) : all_cameras [ network ] . append ( camera_info ) return all_cameras except ( KeyError , TypeError ) : _LOGGER . error ( "Unable to retrieve cameras from response %s" , response ) raise BlinkSetupError