Repo with homework for MIPT "Architecture of computer networks" course.
The app allows you to use your Raspberry Pi as a surveillance system with the following features:
- Web streaming from the camera.
- Motion detection with notifications to the telegram channel.
- Ngrok tunnel manager to get access to your Raspberry from the outside.
This application consist of the following components:
- A telegram bot to control the host Raspberry Pi [Alexander Rezanov].
- A web stream server with stream from the camera [Nikita Chestnov].
- A surveillance system with telegram notifications [Vladyslav Dusiak].
- Install the surveillance system (with a telegram part) from this repo.
- Download ngrok from the official webiste and get a token for your ngrok instance.
- Create a
~/bin/ngrok
directory and place downloaded ngrok there. - Move the
ngrok.yml
to~/.ngrok2
directory. Replace<insert_your_token_here>
string with your ngrok token. You can also change the region. - Get your user ID to set the ownership for you bot using @userinfobot bot.
- Generate
tg_bot.service
file usinggenerate_service.py
script. - Move generated
tg_bot.service
to/etc/systemd/system/
. - Execute
sudo systemctl enable tg_bot.service
andsudo systemctl start tg_bot.service
. - Done. Now you can use the app.
Here the list of available bot commands (this list can be obtained by sending /help
command to the bot):
/help - show this message
/start - check the access
/get_log [N] - get ngrok logs (last N lines)
/ngrok - ngrok commands (start, stop, status)
/ws - web stream commands (start, stop, status)
/rs - rpi-surveillance commands (start, stop, status)
/capture_frame - capture a single frame (you can select a resolution)
/reboot - reboot the host
Unfortunately you can't start the web steream and the surveillance system at the same time, because both of them captures the camera on your Raspberry but the camera can be captured by only one app.
After you started ngrok URLs can be obtained from the ngrok's logs by the /get_log
command. This log will be cleaned at every /ngrok start
command.