fdia module

async fdia.camera_task(shutdown_event: Event, config: Configuration, loop, camera_task_queue_async: Queue, message_task_queue: Queue)

Asynchronously runs the camera task.

Args:

shutdown_event (threading.Event): The event used to signal the shutdown of the task. config (config_util.Configuration): The configuration object. loop (asyncio.AbstractEventLoop): The event loop. camera_task_queue_async (asyncio.Queue): The asynchronous queue for camera tasks. message_task_queue (queue.Queue): The queue for message tasks.

Returns:

None

This function starts the camera task by creating a Camera object with the provided configuration, event loop, and queues. It then enters a loop that continues until the shutdown event is set. Inside the loop, it calls the start method of the Camera object and waits for 0.1 seconds before the next iteration. After the loop exits, it logs that the camera task shutdown is complete.

fdia.default_log_level = 20

Define code logging

fdia.main() None

The main function that starts the program.

This function initializes the necessary objects and threads for the program to run. It sets up the configuration, creates instances of the Telegram bot and the camera thread, and starts the threads. It then enters a loop that continues until a keyboard interrupt is received. Inside the loop, it waits for 0.01 seconds before the next iteration. After the loop exits, it sets the shutdown event, joins all the threads, and exits the program.

Parameters:

None

Returns:

None

fdia.run_web_app(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue, camera_task_queue_async: Queue, door_open_task_queue: Queue)

Initializes and runs the web application for the door opener.

Args:

shutdown_event (threading.Event): The event for shutting down the web app. config (config_util.Configuration): The configuration object for the web app. loop: The event loop for the web app. message_task_queue (queue.Queue): The queue for message tasks. camera_task_queue_async (asyncio.Queue): The asynchronous queue for camera tasks. door_open_task_queue (queue.Queue): The queue for door open tasks.

Returns:

None

fdia.thread_cameras(shutdown_event: Event, config: Configuration, loop, camera_task_queue_async: Queue, message_task_queue: Queue)

Starts the camera task in a separate thread.

Args:

shutdown_event (threading.Event): The event used to signal the shutdown of the camera task. config (config_util.Configuration): The configuration object. loop (asyncio.AbstractEventLoop): The event loop. camera_task_queue_async (asyncio.Queue): The asynchronous queue for camera tasks. message_task_queue (queue.Queue): The queue for message tasks.

Returns:

None

This function starts the camera task by creating a Camera object with the provided configuration, event loop, and queues. It then enters a loop that continues until the shutdown event is set. Inside the loop, it calls the start method of the Camera object and waits for 0.1 seconds before the next iteration. After the loop exits, it logs that the camera task shutdown is complete.

fdia.thread_door_bell(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue, camera_task_queue_async: Queue) None

Door bell watch thread.

fdia.thread_open_door(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue, door_open_task_queue: Queue) None

Creates an instance of the DoorOpener class and starts the door opener loop in a separate thread.

Args:

shutdown_event (threading.Event): The event used to signal the shutdown of the door opener. config (config_util.Configuration): The configuration object for the door opener. loop: The event loop for the door opener. message_task_queue (queue.Queue): The queue for message tasks. door_open_task_queue (asyncio.Queue): The asynchronous queue for door open tasks.

Returns:

None

This function creates an instance of the DoorOpener class and calls its start method to start the door opener loop. The door opener loop runs in a separate thread and is responsible for opening the door when a door open task is received. The function takes the following parameters: - shutdown_event: An event object used to signal the shutdown of the door opener. - config: The configuration object for the door opener. - loop: The event loop for the door opener. - message_task_queue: The queue for message tasks. - door_open_task_queue: The asynchronous queue for door open tasks.

The function does not return any value.

fdia.thread_receive_telegram_msg(shutdown_event: Event, config: Configuration, loop, camera_task_queue_async: Queue, door_open_task_queue: Queue)

Starts receiving messages from the Telegram Bot using the provided parameters.

Parameters:
  • shutdown_event: threading.Event

  • config: config_util.Configuration

  • loop:

  • camera_task_queue_async: asyncio.Queue

  • door_open_task_queue: queue.Queue

Returns:

No return value.

fdia.thread_send_telegram_msg(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue)

Starts a new instance thread for sending messages via Telegram Bot.

Parameters:
  • shutdown_event: threading.Event

  • config: config_util.Configuration

  • loop: Loop

  • message_task_queue: queue.Queue

Returns:

No return value.