Skip to main content

Webcam Security

PyPI version Python Versions Downloads

A Python package for webcam security monitoring with Telegram notifications. This package provides updatedon detection capabilities with configurable monitoring hours and automatic video recording.

Features

  • 🎥 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

Telegram Bot Commands

Once the monitoring is running, you can control it remotely via Telegram commands:

Status & Control

  • /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

Configuration

  • /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)

System

  • /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)

Usage

Quick Start

  1. Initialize configuration:

    webcam-security init --bot-token "YOUR_BOT_TOKEN" --chat-id "YOUR_CHAT_ID" --device-id "MyCamera" --media-path "~/my-recordings"
    
  2. Start monitoring:

    webcam-security start
    
  3. Control remotely via Telegram:

    • Send /start to your bot for command list
    • Use /force_on to enable monitoring immediately
    • Use /set_hours 22 6 to set monitoring hours
    • Use /restart to restart the application after updates

Device Identification

All media sent to Telegram includes a device identifier:

  • If you specify --device-id during 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

Media Storage

Recordings and snapshots are stored in a configurable location:

  • Default: ~/webcam-security (in your home directory)
  • Custom: Use --media-path during init or /set_media_path via Telegram
  • Examples:
    • ~/Documents/security - Store in Documents folder
    • /var/security/recordings - Store in system directory
    • ~/Desktop/camera1 - Store on desktop with device name

Application Restart

After updating the software, new features may not be available until the application is restarted:

  • CLI: Use webcam-security restart to restart the application
  • Telegram: Use /restart command to restart the application
  • Manual: Stop the application (Ctrl+C) and run webcam-security start again

Available Commands

  • webcam-security init - Initialize configuration
  • webcam-security start - Start monitoring
  • webcam-security status - Show current configuration
  • webcam-security clean - Manually clean old recordings
  • webcam-security update - Check for and install updates
  • webcam-security self-update - Auto-update and restart
  • webcam-security self-update-async - Start async update with retry logic
  • webcam-security restart - Restart application to load updated code

Release files for webcam-security 0.3.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webcam-security 0.3.25
File Size Uploaded
webcam_security-0.3.25.tar.gz 24.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webcam-security 0.3.25
File Interpreter ABI Platform
webcam_security-0.3.25-py3-none-any.whl Python 3 none any Details

Total release size: 47.1 kB

Release files / webcam_security-0.3.25.tar.gz

Download URL webcam_security-0.3.25.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f07d3c051d4245d9b26f91ac60500e9765a9017c72112f11feab78d3e59734c
BLAKE2b-256 checksum
How to use checksums
e49bdd8e24bfd681a2a1fd3629db63e41a62cee364402df8314e3eb57ca752d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / webcam_security-0.3.25-py3-none-any.whl

Download URL webcam_security-0.3.25-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
323c457351d49267d4b4541a5be04bf039b03b19125f6fa5884165b38160f383
BLAKE2b-256 checksum
How to use checksums
2542d058ee07f4abe887c333adf3c7c2683c7a4fbf47427aa40c0463cf508d45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.3.25 This release

2 release files

0.3.20

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page