This add-on integrates Raspberry Pi camera functionality with GSM capabilities to provide security monitoring for remote locations with limited internet connectivity. When triggered, it captures video, uploads it to Google Drive, and sends SMS notifications with GPS location information.
- Video Capture: Record video from Raspberry Pi Camera Module
- Google Drive Integration: Upload videos to Google Drive for storage
- SMS Notifications: Send alerts via SMS with video links
- GPS Location: Include GPS coordinates in notifications
- Resumable Uploads: Handle slow or unreliable connections
- Early Notifications: Option to send alerts before upload completes
- Progress Tracking: Monitor upload progress in real-time
- Add this repository to your Home Assistant instance
- Install the "GSM RPICAM HASS" add-on
- Configure the add-on as described below
- Start the add-on
- Raspberry Pi with Home Assistant OS
- Raspberry Pi Camera Module
- GSM modem with SIM card (supports SMS and GPS)
- Google account with Google Drive
- Google Cloud Platform project with Drive API enabled
google_credentials: "" # Google service account credentials JSON
folder_id: "videos" # Google Drive folder ID
video_directory: "/share/gsm_rpicam_videos" # Local video storage path
debug_mode: false # Enable detailed logging
send_early_notification: true # Send SMS before upload completes
include_location: true # Include GPS location in SMS
wait_for_gps: false # Wait for GPS location at startup
gps_timeout: 30 # Max seconds to wait for GPS fix- Create a Google Cloud Platform project
- Enable the Google Drive API
- Create a service account with Drive access
- Download service account credentials JSON
- Copy the contents of the JSON file into the
google_credentialsfield - Create a folder in Google Drive and get its ID from the URL
- Add the folder ID to the
folder_idfield
The add-on exposes the following API endpoints:
-
POST /api/trigger/start: Start recording and upload process{ "phoneNumber": "+1234567890", "videoDuration": 10000, "sendEarlyNotification": true, "videoFilename": "custom_name.h264" } -
GET /api/trigger/:id: Get status of a specific trigger -
GET /api/trigger/upload/:id: Get detailed status of a specific upload -
GET /api/trigger/uploads: List all uploads -
DELETE /api/trigger/upload/:id: Cancel an ongoing upload
automation:
- alias: "Motion Detection Recording"
trigger:
platform: state
entity_id: binary_sensor.motion_sensor
to: 'on'
action:
- service: rest_command.start_recording
data:
phoneNumber: "+1234567890"
videoDuration: 15000rest_command:
start_recording:
url: http://localhost:8000/api/trigger/start
method: POST
content_type: 'application/json'
payload: '{"phoneNumber":"{{ phoneNumber }}","videoDuration":{{ videoDuration }}}'When GPS data is available, the add-on includes a Google Maps link in SMS notifications:
Alert: Motion detected. View recording at: [RECORDING_LINK]
Location: https://www.google.com/maps/search/?api=1&query=12.3456,-65.4321
If GPS data is not available, the message will indicate:
Location: Not available
When send_early_notification is enabled, the SMS is sent as soon as the video is recorded, before the upload starts. This ensures the user receives a notification even if the upload takes a long time or fails:
Alert: Motion detected. Video is being uploaded, link will be active soon.
Location: https://www.google.com/maps/search/?api=1&query=12.3456,-65.4321
include_location: Include GPS coordinates in SMS notificationswait_for_gps: Wait for a valid GPS fix during startupgps_timeout: Maximum seconds to wait for GPS (1-120)
If SMS notifications are not working:
- Check the GSM modem is properly connected
- Verify the SIM card has credit and is activated
- Check that
/dev/ttyUSB0is available - Ensure the modem supports the
mmclicommand
If uploads are failing:
- Verify Google credentials are correct
- Check that internet connection is available
- Check add-on logs for specific error messages
- Try a smaller video duration for testing
If GPS location is not available:
- Ensure the GSM modem supports GPS functionality
- Move the device to a location with better GPS reception
- Allow more time for GPS acquisition
- Check if the SIM plan includes GPS/location services
- Videos are stored in the configured
video_directory - Each trigger creates a uniquely named video file
- Upload status is tracked in memory and available via API
- Google Drive credentials are securely stored in
/data/google-credentials.json
- CPU: Moderate during video recording and file processing
- Memory: Typically 100-200MB depending on configuration
- Storage: Depends on video length and quality
- Upload bandwidth: Depends on video size
- GSM data: Minimal, used only for upload
- SMS: One message per trigger event
For issues, questions, or feature requests, please create an issue in the GitHub repository.
This add-on is licensed under the MIT License.
- Based on the Home Assistant Add-on SDK
- Uses the ModemManager CLI for GSM functionality
- Utilizes the Google Drive API for cloud storage