Notifications from Blink Cameras to Telegram

Martedì 25 Febbraio 2025

This post aims to solve some problems I encountered with the Amazon Blink video surveillance camera system: Blink app notifications take some time to be verified, especially if you don't have a subscription. Therefore, every time the alarm goes off, you have to open the application and download each video from the sync module.

The solution: I modified the system so that each video recorded by the cameras is forwarded to my Telegram account. This feature is not available with the normal Blink system, and it is not even possible to directly access the Sync Module's storage.

Note: There is outdated documentation on the API that the app uses to communicate with the cloud, but unfortunately, the session token and the two-factor authentication system make it really inconvenient in the long run because it is necessary to regularly renew the token by manually providing the pin received on the mobile phone, so I abandoned this path.

The trick was to use a Raspberry PI Zero W in OTG mode that replaces the Sync Module's USB stick and sends the new videos that are recorded to Telegram. The PI Zero is the only model that is powered without problems directly from the Sync Module and therefore does not require connection to an additional power source.

To configure the Pi Zero in OTG mode, you can find various tutorials. In short:

1. Create the file that will be made available as space to save the videos through the usb-c port of the Raspberry:

sudo dd if=/dev/zero of=/piusb.bin bs=512 count=2880

2. Format Fat32 or as you prefer, as the Sync Module will take care of it:

sudo mkdosfs /piusb.bin

3. Execute the mount at startup from crontab or from rc.local:

modprobe g_mass_storage file=/piusb.bin stall=0

losetup -o 16384 /dev/loop0 /piusb.bin

The definition of loop0 is necessary to fetch the correct point inside the file from which to read the directory when /piusb.bin is mounted locally

It's time to create a small script with your favorite language that performs the following procedure:

1. Check the last modification to /piusb.bin

2. If the file has been modified, execute the mount:

mount /dev/loop0 /mnt/usb

3. Fetch the latest video file from /mnt/usb and send it if it is actually new: sometimes the Sync Module writes other data on the stick, so it is not safe to detect the new video only by checking the timestamp of the file /piusb.bin

4. Unmount /mnt/usb to avoid blocking the file system that the Sync Module needs

The sending operation is at your discretion: an email, a message via a Telegram bot, a push notification. It's up to you. I usually use the Telegram API by directly attaching the video

I would say that's all; I hope you find this free power-up of the Blink system useful. I am available for any questions and apologize if I almost never make technical posts on this site, but my attentions are now focused on other hobbies!


«Indext»