Configuration
Configuration for camguard is done in a yaml-File with a configurable path, which will be set to $HOME/.config/camguard/settings.yaml by default. The parent directory path can be changed with the cli flag -c CONFIG_PATH (see Command Line Interface).
When installing camguard by using the available Makefile, a default configuration for Raspberry Pi is automatically copied to the default path.
Settings
Components
camguard uses component based settings where each of this components can be switch on, off or set into a dummy mode for testing, without using Raspberry Pi specific dependencies.
components:
- motion_detector
- motion_handler
- file_storage
- mail_client
- network_device_detector
Motion detector (motion_detector)
motion_detector node:Implementation Type (implementation)
enumraspiraspidummy
Implementation Settings
The settings node of the selected implementation type, available values are:
raspi_gpio_sensor
dummy_gpio_sensor
Following settings are only available for ``raspi_gpio_sensor``.
Raspberry Pi GPIO-Pin Number (gpio_pin_number)
integerNotification LED GPIO-Pin Number (notification_led_gpio_pin_number)
integerQueue Length (queue_length)
integer1 (this effectively disables the queue)Queue Threshold (threshold)
float0.5 (which means half of the queue has to be considered active)Sample Rate (sample_rate)
float10.0Example configuration for Raspberry Pi
motion_detector:
implementation: raspi
raspi_gpio_sensor:
gpio_pin_number: 23
notification_led_gpio_pin_number: 0 # default
queue_length: 1 # default
threshold: 0.5 # default
sample_rate: 10.0 # default
Example configuration for Dummy usage
motion_detector:
implementation: dummy
dummy_gpio_sensor:
# no value available
Motion Handler (motion_handler)
motion_handler node:Implementation Type (implementation)
enumraspiraspidummy
Implementation Settings
The settings node of the selected implementation type, available values are:
raspi_cam
dummy_cam
Following settings are the same for both dummy_cam and raspi_cam.
Recording root folder path (record_path)
string'$HOME/.camguard/records'Record count (record_count)
integer15Record interval seconds (record_interval_seconds)
float1.0Record file name format (record_file_format)
counter represents the current picture count, timestamp the current date-time. Both can be combined in a formatting template.string'{counter:03d}_{timestamp:%y%m%d_%H%M%S%f}_capture.jpg'Example configuration for Raspberry Pi
motion_handler:
implementation: raspi
raspi_cam:
record_path: '$HOME/.camguard/records' # default
record_count: 15 # default
record_interval_seconds: 1.0 # default
record_file_format: "{counter:03d}_{timestamp:%y%m%d_%H%M%S%f}_capture.jpg" # default
Example configuration for Dummy usage
motion_detector:
implementation: dummy
dummy_cam:
record_path: '$HOME/.camguard/records' # default
record_count: 5
record_interval_seconds: 0.5
record_file_format: "{counter:03d}_{timestamp:%y%m%d_%H%M%S%f}_capture.jpg" # default
File Storage (file_storage)
file_storage node:Implementation Type (implementation)
enumdefault (google drive storage)defaultdummy(selects a dummy/offline implementation of the file storage for testing purposes)
Implementation Settings
The settings node of the selected implementation type, available values are:
gdrive_storage
dummy_gdrive_storage
Following settings are only available for ``gdrive_storage``.
Upload folder name (upload_folder_name)
string'Camguard'OAuth token path (oauth_token_path)
token.json file.string'.'OAuth credentials path (oauth_credentials_path)
credentials.json file.string'.'Example configuration for GDrive File Storage
file_storage:
implementation: default
gdrive_storage:
upload_folder_name: 'Camguard' # default
oauth_token_path: "~/.config/camguard"
oauth_credentials_path: "~/.config/camguard"
Example configuration for Dummy usage
file_storage:
implementation: dummy
dummy_gdrive_storage:
# there are no specific settings for this node
Mail client (mail_client)
mail_client node:Implementation Type (implementation)
enumdefault (SMTP mail client implementation)defaultdummy(selects a dummy/offline implementation of the mail client for testing purposes)
Implementation Settings
mail_client node.Username (username)
stringPassword (password)
stringSender mail (sender_mail)
stringReceiver mail (receiver_mail)
stringHostname (hostname):
stringExample configuration for SMTP Mail Client
mail_client:
implementation: default
username: 'my-mail-user'
password: 'my-user-password'
sender_mail: 'user@mail-domain.com'
receiver_mail: 'recipient@gmail.com'
hostname: mail-domain.com
Example configuration for Dummy usage
mail_client:
implementation: dummy
username: 'my-mail-user'
password: 'my-user-password'
sender_mail: 'user@mail-domain.com'
receiver_mail: 'recipient@gmail.com'
hostname: mail-domain.com
Network Device Detector (network_device_detector)
Implementation Type (implementation)
enumdefaultdefaultdummy(selects a dummy/offline implementation of the network device detector for testing purposes)
Implementation Settings
The settings node of the selected implementation type, available values are:
nmap_device_detector
dummy_network_device_detector
Following settings are only available for ``nmap_device_detector``.
IP Addresses (ip_addr)
list[str]Interval Seconds (interval_seconds)
floatExample configuration for nmap Device Detector
network_device_detector:
implementation: default
nmap_device_detector:
ip_addr:
- '191.168.0.1'
- '191.168.0.2'
interval_seconds: 4.0
Example configuration for Dummy Device Detector
network_device_detector:
implementation: dummy
dummy_network_device_detector:
# there are no specific settings for this node
Configuring Google-OAuth for Google-Drive
To enable the file storage for google-drive usage (see :ref:’file-storage-label`), it’s necessary to configure google-oauth authentication for your google account following these steps:
Create a Google Cloud Platform Project
Enable Google-Drive API
Create access credentials
Configure OAuth consent screen. ⚠️ Take care to not configure a logo/icon for the project, otherwise you’ll have to verify your production state. 1
Set Application Type to Desktop
Download client secret json and rename it to credentials.json
Copy credentials.json to ~/.config/camguard or configure OAuth credentials path (oauth_credentials_path)
Footnotes
- 1
Google verifies projects configured for a user type of External and a publishing status of In production if they meet special criterial like displaying icon/logo on OAuth consent screen. See Google Project Verification Status