- I am not a developer. There may be better ways to implement this and if so, let me know.
- My files are all running from /root. Adjust accordingly. Edit files with your editor of choice, I use nano.
- telegram-notify install instructions are linked but also detailed below
- I modified zm-alarm.pl and renamed it to keep naming consistent with my scripts.
- This will notify every 5 seconds while there is an alarm. Modify to your needs. If you want just a single notification, you can send the alarm.jpg file over instead of the -capture.jpg and set the time to be something extremely high.
- I couldn't get my script running from crontab, so I had to go the service route.
- Person detection notifications requires zmeventnotification.
- jq is required to process the json for person detection
cd /root
$ apt-get install curl git jq
$ git clone https://github.com/samsulmaarif/telegram-notify.git
Edit send-message
file, change the value line 25 FILE_CONF
with the path of file telegam-notify.conf
$ nano /root/telegram-notify/send-message
FILE_CONF="/etc/telegram-notify.conf"
$ nano /etc/telegram-notify.conf
$ ln -s /root/telegram-notify/send-message /usr/bin/telegram-notify
$ chmod +x /root/telegram-notify/send-message
$ telegram-notify --text "test"
$ git clone https://github.com/TheDave1022/ZoneMinder_TelegramAlertNotifier.git
$ mv ZoneMinder_TelegramAlertNotifier/* /root
$ chmod +x zm_telegram_alert.sh
$ chmod +x zm_telegram_service.sh
$ systemctl daemon-reload
$ systemctl enable zm_telegram.service
$ systemctl start zm_telegram.service
- path - Default is "/var/cache/zoneminder/events/$camera_id/$current_date/". Only replace "/var/cache/zoneminder/events/" if you use a different location
- person_detection_percentage - Default 30%. Lower is better if you are using IR on your cameras
- sleep_time - Default is 5 seconds. Amount of time between alarm messages
I mute my alarm group to avoid my telegram going off constantly. If you want to be notified on a notified group/channel you can set a different ID. Edit lines 87 and 124 and add --user "-#########" (Replace the # with your channel/group id)
You can force them through ZM or go stand in front of your camera
$ systemctl status zm_telegram.service
$ ./zm_telegram_alert.sh CAMERA_ID