Feeder with video tape telegram

We make a bird feeder with automatic feed and automatic video sending to ourselves in Telegram.





Idea

Last summer, many of my friends hung transparent plexiglass feeders on their windows, which began to appear in large quantities on aliexpress, and in ordinary stores. Looking at their Instagram stories, I also wanted to look at the birds.





, , , . , . , . " , ?". - , , . .





, - . , , . , , , - .





, ! , , , , - . ! , . , , - . .





- ( ), - . , ?





. 2 . - . , . ESP8266 -. . .





. ( , ). 3 2 .





. 3-4 (!) 2 . . 90% - . , , - , , .





, :





3 : https://a360.co/3rsSLRZ





:





  • ( )





  • 120 150





  • 23





  • 2020 ( )









  • 4 50-70









  • 2 4





. - . . , 22.5 - . . ( 4 2 - ). .





, . (, ).





selection of options how to fix

- - . , . . - ( ), .





, ?

- . (85/ ) - , , .





, - ( ), , , , .





. , - , .





, .





, .





. , . - . . - , , , . ( ) - 2. . ( ), ( ).





- - =)





ESP , :





:





  • 110 (1.5-2 ) -





  • 110





  • 110 50





  • 50 (- )





  • 45°





  • 110 - .





  • 110





  • - ( , , )





. , :





- 50 . 32, 40 - . .





" ". - .





- (13-16 ) . , . - -. - .





110-50 - 50 - .





- 160 .





-

. IP Webcam. -, USB. :





HikWision IP camera lying around with nothing to do
IP HikWision

:





  • IP-





  • Raspberry Pi -.





  • , WiFi, ( )





  • ,





- , core2duo c 2 . Debian zoneminder -.





ZoneMinder , , - - , .





- Ubuntu, - zoneminder - , - . ( , )





, , ,





( , . --)





, , .





, . zoneminder- : 18.04. , , SSH- - . , security updates.





net-tools mc, jq:





sudo apt-get update
sudo apt-get install net-tools mc jq
      
      



ifconfig IP , , Putty.





, . Zoneminder-, ZoneMinder:





sudo add-apt-repository ppa:iconnor/zoneminder-1.34
sudo apt-get dist-upgrade
sudo apt-get update
sudo apt-get install zoneminder

      
      



, , . ZoneMinder:





sudo chmod 740 /etc/zm/zm.conf
sudo chown root:www-data /etc/zm/zm.conf
sudo chown -R www-data:www-data /usr/share/zoneminder/

sudo a2enmod cgi
sudo a2enmod rewrite
sudo a2enconf zoneminder
sudo a2enmod expires
sudo a2enmod headers

sudo systemctl reload apache2

sudo systemctl enable zoneminder
sudo systemctl start zoneminder
      
      



, ( IP !): http://192.168.1.61/zm





:





. .





Option-System-Lang_default, . TimeZone.





Storage . , :





:





mkdir -p /home/user/zoneminder/ptichki
sudo chown -R root:www-data /home/user/zoneminder/
sudo chmod -R 775 /home/user/zoneminder
      
      



- !





- ONVIF - . , , . :





  • , - XMEye ( )





  • HikVision





  • IP Webcam





- Hikvision Internet Explorer (!), - .





, , ONVIF . :

IP Internet Explorere, , , .





. :





Hikvision

IP Internet Explorer, :





IP Webcam

ZoneMinder, () " ". - " ONVIF". : - . . - . . - - onvif device manager .





1.2 MainStream. , ( ), Modect - . Storage:





ONVIF , "". " " :





-

:





rtsp://admin:pass@192.168.1.31:554/user=admin_password=vRnLzCDX_channel=1_stream=0.sdp?real_stream
      
      



HikVision:





rtsp://admin:password@192.168.1.32:554/Streaming/Channels/101?transportmode=mcast&profile=Profile_1
      
      



IP Webcam:





rtsp://:@192.168.1.33:8080/h264_ulaw.sdp
      
      



Example of a filled window

, , . . - . , .





- .





, - cURL- api.telegram.org, .





, :





@botfather 1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg





. , : https://api.telegram.org/bot1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg/getUpdates ID. :





: https://api.telegram.org/bot1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg/sendMessage?chat_id=1234567&text=%20





, , , . cURL





:





curl -s -X POST \
	   -F chat_id=1234567 \
	   -F text=TEST \
	    https://api.telegram.org/bot1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg/sendMessage
      
      



? JSON- , {"ok":true





-. . mc:





: 1 - , - 14 ( ). cURL- ( ):





curl -X POST \
	   -F chat_id=1234567 \
	   -F video=@/home/user/zoneminder/ptichki/1/2021-03-28/14/14-video.mp4 \
	   https://api.telegram.org/bot1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg/sendVideo
      
      



, , - , - .





, , . .





@yiv, .









nano ~/telega.sh 
      
      



( ):





telega.sh
chat_id="1234567"
api_url="https://api.telegram.org/bot1234567890:AbCDefGH123456789ABCDEFGHabcdefghtg"

videopath="/home/user/zoneminder/ptichki"
api_max_attempts=1

send_video() {
                request='sendVideo'
                args="-F video=@$videofile -F caption=$videofile"
         echo `curl -s -F chat_id=$chat_id $args -X POST $api_url/$request | jq -r '.ok'`
}

for videofile in `find $videopath -depth -name "*.mp4" -mmin -10`; do
        for msg_type in 'video'; do
                echo 'Sending '$msg_type' for '$videofile
 				for attempt in  $(seq 1 $api_max_attempts); do
                        echo 'Attempt #', $attempt, 'in while loop'
                        snd_result="$(send_video $msg_type)"
                        echo $snd_result
                        if [ $snd_result == 'true' ]
                                then
                                        if [ $msg_type == 'video' ]
                                                then
                                                        echo 'ok, removing ', $videofile
                                                        rm -f $videofile
                                         fi
                                        break
                                fi
                        sleep 5
                done
        done
done
      
      



Ctrl-X - , Y - .





, *.mp4 , . - 10 . ( api_max_attempts=1) .





, :





 sudo bash /home/user/telega.sh
      
      



sudo , . !





- :





sudo crontab -e
      
      



:





 * * * * * sudo bash /home/user/telega.sh
      
      



, - ! !





- . ZoneMinder- :





"" " " "day" - , "". day:





( modect) "". :





( "") , , , night.





6:30, 19:30. sudo crontab -e :





30 6 * * * sudo zmpkg.pl day
30 19 * * * sudo zmpkg.pl night
      
      



:





43 =) https://t.me/PtichenkiNaDachke , . , , . , , , , , , , , . . .





- . - , !





, , , .





- . , .





, .





, .





- . , , .





# , . - - , .





:





, . . - - .





/ , - .





! . . , .





. , , .





- . , .





ZoneMinder- . , , - . 15 . , , . - - !





- , , , . - : ( ). - FPS. - WiFi. - 5 - .





! - - .





- . , . . ( )





- , , . , . . . . , .





P.S.

, , . , DIY . , - - , - - .





, !








All Articles