Keeping an eye on the backyard cats
We’ve been taking care of some cats in the backyard, and I wanted a way to monitor which ones came in and ate on a given day and which ones are staying in the houses.
I try to use old computers as much as I can, and also I didn’t want to spend any money on it. So I thought it would be fun to use an old iPhone as the camera. I looked around and I found an app called IP Camera Pro which has a built-in HTTP server for streaming the video. Here’s what I did:
Download an app that streams video
I looked around and I found an app called IP Camera Pro which has a built-in HTTP server for streaming the video. I did pay for the app, but I bet there’s a free one somewhere!
I could stop here and simply expose the server to the internet, but I honestly wasn’t confident about doing that with an outdated iOS version.
Using an old laptop
Thankfully I have a Debian 13 server at home that I can install Motion, on and I configured it to connect to the iPhone’s feed in /etc/motion/motion.conf:
# The full URL of the iPhone camera stream.
netcam_url http://192.168.1.2:8081/video
# Add a password so that only a few people can have access to it.
stream_auth_method 1
stream_authentication username:password
############################################################
# Image Processing configuration parameters
############################################################
camera_name iPhone
# Image width in pixels.
width 1280
# Image height in pixels.
height 720
# Maximum number of frames to be captured per second.
framerate 10
############################################################
# Live stream configuration parameters
############################################################
# The port number for the live stream.
stream_port 8081
# Restrict stream connections to the localhost.
stream_localhost off
Once you restart the service by running sudo systemctl restart motion.service you should be able to see something on localhost:8081. If not, check the logs in sudo journalctl -f -u motion.service to see if there are no errors.
Getting notifications
Additionally, I wanted to get notified when there’s movement detected so that I can go see which cat is around in the backyard. So I created the directory /var/motion and a file called /var/motion/notify.sh and made sure it’s owned by the motion user by running sudo chown -R motion:motion /var/motion/. The script uses the service ntfy to send a notification to my device:
#!/usr/bin/bash
curl \
-d "Motion detected! 😺" \
ntfy.sh/58whVdK78mwfo3NB
Then I added this line in /etc/motion/motion.conf and restarted the service:
on_event_start /var/motion/notify.sh