A Python package for webcam security monitoring with Telegram notifications. This package provides motion detection capabilities with configurable monitoring hours and automatic video recording.
- 🎥 Real-time motion detection using webcam
- 📱 Telegram notifications with snapshots and device identification
- ⏰ Configurable monitoring hours (default: 10 PM - 6 AM)
- 🔧 Telegram bot commands for remote configuration
- 🚨 Force monitoring on/off via Telegram
- 🎬 Automatic video recording on motion detection
- 🎵 Audio recording with video (combined MP4 format)
- 🧹 Automatic cleanup of old recordings
- 🖥️ Live preview with monitoring status
- 🚀 Easy-to-use CLI interface
- 🔄 Self-update mechanism
- ⚡ UV-powered for faster builds and dependency management
Once the monitoring is running, you can control it remotely via Telegram commands:
/start- Welcome message and command list/status- Show current configuration and monitoring status/help- Show detailed help and command reference/force_on- Force monitoring ON (ignores time schedule)/force_off- Force monitoring OFF (returns to normal schedule)/peek- Take manual photo and send to Telegram
/set_hours <start> <end>- Set monitoring hours (24h format)- Example:
/set_hours 22 6(10 PM to 6 AM) - Example:
/set_hours 0 24(24/7 monitoring)
- Example:
/update- Check for software updates/update_async- Start async update with retry logic (5 attempts)/restart_bot- Restart bot polling thread if it stops responding/restart- Restart entire application (loads new code after updates)
-
Initialize configuration:
webcam-security init --bot-token "YOUR_BOT_TOKEN" --chat-id "YOUR_CHAT_ID" --device-id "MyCamera" --media-path "~/my-recordings"
-
Start monitoring:
webcam-security start
-
Control remotely via Telegram:
- Send
/startto your bot for command list - Use
/force_onto enable monitoring immediately - Use
/set_hours 22 6to set monitoring hours - Use
/restartto restart the application after updates
- Send
All media sent to Telegram includes a device identifier:
- If you specify
--device-idduring init, that name will be used - Otherwise, the system hostname will be used automatically
- This helps identify which camera sent the alert when you have multiple systems
Recordings and snapshots are stored in a configurable location:
- Default:
~/webcam-security(in your home directory) - Custom: Use
--media-pathduring init or/set_media_pathvia Telegram - Examples:
~/Documents/security- Store in Documents folder/var/security/recordings- Store in system directory~/Desktop/camera1- Store on desktop with device name
After updating the software, new features may not be available until the application is restarted:
- CLI: Use
webcam-security restartto restart the application - Telegram: Use
/restartcommand to restart the application - Manual: Stop the application (Ctrl+C) and run
webcam-security startagain
webcam-security init- Initialize configurationwebcam-security start- Start monitoringwebcam-security status- Show current configurationwebcam-security clean- Manually clean old recordingswebcam-security update- Check for and install updateswebcam-security self-update- Auto-update and restartwebcam-security self-update-async- Start async update with retry logicwebcam-security restart- Restart application to load updated code