Tuesday, October 10, 2017

motionEyeOS (Raspberry PI) notification via LINE Notify

motionEyeOS (CCTV Software)

motionEyeOS is A Video Surveillance OS For Single-board Computers

motionEyeOS Source: https://github.com/ccrisan/motioneyeos
motionEye Source: https://github.com/ccrisan/motioneye

Download motionEyeOS Image: https://github.com/ccrisan/motioneyeos/releases

motionEyeOS Wiki: https://github.com/ccrisan/motioneyeos/wiki

How to install can see at Raspberry PI Spy (https://www.raspberrypi-spy.co.uk/2017/04/raspberry-pi-zero-w-cctv-camera-with-motioneyeos/)

LINE Instant Messager

LINE Notify Service: https://notify-bot.line.me/en/

  • Login with LINE Account

  • Select menu My page

  • Select Generate Token button

  • Enter token name and select 1-on-1 chat with LINE Notify or Group for send notification
  • Select Generate Token button

  • I will show token for send notification. copy it. and select close button

  • In LINE Instant Messenger will have LINE Notify Account add to you.  

Test send notify with curl
curl -k -X POST -H 'Authorization: Bearer [access_token]' -F 'message=hello' https://  
After run this curl command. You will receive message 'Hello' to LINE Instant Messenger via LINE Notify

If you want to send Message and Image to LINE Instant Messager, you can curl with this command.

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F 'message=hello' -F 'imageFile=@[**file path to image]' https://  
**file path to image = Image file Supported image format is png and jpeg
Image will upload to server for send notification.

More Information
LINE Notify API Document: https://notify-bot.line.me/doc/en/
LINE Engineer Blog: https://engineering.linecorp.com/en/blog/detail/88

Create script for send notification on motionEyeOS

  • create directory /data/script with command
mkdir /data/script
  • create shell script
File: /data/script/linenotify_push.sh

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F "message=$1" https://

File: /data/script/linenotify_pushimage.sh

curl -k -X POST -H 'Authorization: Bearer [access_token]' -F "message=$1" -F "imageFile=@$2" https://

  • change mode of file to executable file.

chmod 755 linenotify_push.sh
chmod 755 linenotify_pushimage.sh

Test script file

/data/script/linenotify_push.sh "Good world"

It will receive "Good world" message at LINE Instant Message

/data/script/linenotify_pushimage.sh "Good Job" "/data/output/Camera1/test.jpg"

It will receive "Good Job" message and test.jpg image at LINE Instant Message.

Now. You can run script for sent notification.

Use notification script at motionEyeOS

  • Login on motionEyeOS

  • Go to Motion Notifications section

  • Enable Run A Command (Send notification if motionEyeOS detect motion on camera)
  • On command box enter command

/data/script/linenotify_push.sh "Motion Detect at %Y-%m-%d %H-%M-%S"

  • (Option) If you want to send notification after finish motion detect, Enable Run An End Command and  enter command.

/data/script/linenotify_push.sh "Motion Detect End at %Y-%m-%d %H-%M-%S"

  • If you want to send image of motion detect, go to Still Images section.
  • Select capture mode to Motion Triggered or Motion Triggered (One Picture).

  • go to File storage.
  • Enter command on Run An Command 
/data/script/linenotify_push.sh "Motion Detect at %Y-%m-%d %H-%M-%S" %f

  • go to Motion Detection Section. Enable Motion Detection

  • Select Apply button on top to apply all config.

If motion detect of motionEyeOS detected, I will send "Motion Detect at [Date and Time]" message to LINE Instant Message.

After finish with motion detect (nothing movement) Send "Motion Detect End at [Date and Time]" message to LINE Instant Message.

and Send "Motion Detect at [Date and Time]" message " and image file to send to LINE Instant Message

No comments:

Post a Comment