camera package

Submodules

camera.camera

class camera.camera.Camera(config: Configuration, loop, camera_task_queue_async: Queue, message_task_queue: Queue)

Bases: object

Adds a required 2FA token to blink session.

Parameters:

self (object): The instance of the class. task (Camera_Task): The task containing the 2FA token information.

Returns:

bool: True if the token is successfully added.

Asynchronously takes a snapshot from a Blink camera and saves it to a specified file path.

Returns:

bool: True if the snapshot was successfully taken and saved, False otherwise.

async choose_cam(task: Camera_Task)

Asynchronously chooses a camera based on various conditions such as daylight detection, night vision, and default camera type.

Args:

self: The Camera object. task (Camera_Task): The task containing information for camera selection.

Returns:

The result of the camera selection process.

detect_daylight() bool

Detects daylight and returns a boolean value.

picam_request_download_foto() bool

Downloads a photo from the PiCam REST-API.

This function sends a GET request to the PiCam API to download a photo. The photo is saved to the file specified in the photo_image_path configuration.

Returns:

bool: True if the HTTP request status code is 200, otherwise False.

picam_request_take_foto() bool

A function to request taking a photo using PiCam, sending a POST request with specific parameters, and logging the process.

Returns:

True if the HTTP request status code is 200, otherwise False

Return type:

bool

put_msg_queue_error(task: Camera_Task, message: str)

Puts a message queue error based on the provided task and message.

Args:

task (Camera_Task): The task to be processed. message (str): The error message to be added to the queue.

Returns:

None

put_msg_queue_photo(task: Camera_Task)

Puts a message queue photo based on the provided task.

Args:

task (Camera_Task): The task to be processed.

Returns:

None

Asynchronously reads the Blink configuration file and authenticates with Blink.

This function checks if the Blink configuration file exists. If it does, it loads the configuration file using the json_load function, creates an Auth object with the loaded configuration, sets the auth attribute of the blink object to the created Auth object, logs a message indicating that the authentication was done using the file, and sets the authentication_success variable to True.

If the Blink configuration file does not exist, it logs a message indicating that the file was not found and that a 2FA authentication token is required. It creates an Auth object with the provided Blink username and password, sets the auth attribute of the blink object to the created Auth object, and sets the authentication_success variable to None.

Parameters:

self (object): The instance of the class.

Returns:

None

Saves the authenticated session information of the Blink service into a config file.

This function saves the authenticated session information of the Blink service into a config file. It logs a message indicating that the session information is being saved. Then it calls the save method of the blink object, passing the blink_config_file attribute of the config object as the file path.

Parameters:

self (object): The instance of the class.

Returns:

bool: True if the session information is successfully saved.

async start() None

Initializes the camera, starts a blink session if enabled, and processes various camera tasks asynchronously.

Module contents