Sample repo to have fun with TP-Link Tapo C100 IPCAM
Add the following lines to your .bashrc
file or by adding them in your systemd service as Environment=C100_USER=...
export C100_USER=...
export C100_PASSWORD=...
export C100_SERVER=...
Connects to the cam and display the stream, add -s 1
to select FHD mode, otherwise 360P is the default (-s 2
)
python3 main.py
Motion Detection With Display
python3 main.py -m
Headless Mode, Motion Detection
python3 main.py -m -l
Headless Mode, Motion Detection, Log to $PWD
python3 main.py -m -l -d $PWD
# 1080P
ffplay rtsp://${C100_USER}:${C100_PASSWORD}@${C100_SERVER}/stream1
# 480P
ffplay rtsp://${C100_USER}:${C100_PASSWORD}@${C100_SERVER}/stream2
If you need even smaller display
ffplay -vf scale=240:-1 rtsp://${C100_USER}:${C100_PASSWORD}@${C100_SERVER}/stream2
Result:
Installed an IP cam at my door step for this demo
Result with motion detection enabled
Old monitor + Raspberry Pi 2B = Clock + CCTV
ffmpeg -i rtsp://${C100_USER}:${C100_PASSWORD}@${C100_SERVER}/stream2 FILENAME.mp4
ffmpeg -i rtsp://${C100_USER}:${C100_PASSWORD}@${C100_SERVER}/stream2 $(date +%Y%m%d_%H%M%S).mp4
Motion detectionAdd a motion detection debouncing timer bytime.time()
- Replace
f.write()
withlogger.info()
- Screenshot on motion detected
- Record for a duration on motion detected
- Can consider using
subprocess()
and ffmpeg or use VideoWriter
- Can consider using
- Notification on motion detected (e.g. Telegram Bot)
- Request a bot token
- Add bot token to ENV then retrieve in
main
byos.environ.get("BOT_TOKEN")
- Logging of events (Motion, disconnection etc)
- Local CSV or Webhook to 3rd party HTTP server