door package
Submodules
door.bell module
- class door.bell.DoorBell(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue, camera_task_queue_async: Queue)
Bases:
object
Front door subclass of configuration config watches the door bell and triggers sends telegram message and camera photo.
- ring(test=False) None
Monitors the door bell and triggers a series of actions when the bell rings.
- Args:
test (bool, optional): If True, the function will exit after the first ring. Defaults to False.
- Returns:
None
- Raises:
Exception: If an error occurs during the execution of the function.
door.opener module
- class door.opener.DoorOpener(shutdown_event: Event, config: Configuration, loop, message_task_queue: Queue, door_open_task_queue: Queue)
Bases:
object
- open_door() bool
A function that opens the door based on Raspberry Pi detection.
- Parameters:
self: The object instance.
- Returns:
bool: True if the door is successfully opened, False otherwise.
- start()
Starts the thread endless loop to open the door.
This method runs in an infinite loop until the shutdown_event is set. It continuously retrieves tasks from the door_open_task_queue and processes them. If a task is an instance of Open_Door_Task, it performs the following actions based on the task attributes: - If task.open is True, it logs the received task and opens the door by calling the open_door method. - If task.reply is True and task.message is not None, it puts a Message_Task object with the reply flag set to True, the chat ID from the task, the message from the task, and the data text “Door opened!” into the message_task_queue. - If task.reply is False, it puts a Message_Task object with the send flag set to True, the chat ID from the configuration, and the data text “Door opened!” into the message_task_queue. - If an exception occurs during the execution of the loop, it logs the error and continues.
- Parameters:
None
- Returns:
None
door.detect_rpi module
- door.detect_rpi.detect_rpi(run_on_raspberry: bool) bool
Detects whether the system is running on a Raspberry Pi based on the model information retrieved from ‘/sys/firmware/devicetree/base/model’ or ‘/proc/cpuinfo’.
- Args:
run_on_raspberry (bool): A boolean indicating whether to force the function to run on a Raspberry Pi.
- Returns:
bool: True if a Raspberry Pi is detected, False otherwise.