The red light on the camera module should now light up. On the same network as the Raspberry, the stream can now be found by opening a browser and going to http://<raspberry ip>:8080
Making it into a service
By making the live stream into a system service, we can make it turn on automatically on reboot (or after power outage) and more easily control turning it on and off. Create a new file called /etc/systemd/system/livestream.service with the following content:
Accessing the stream from outside the local network
To be able to view the live stream from outside your local network, go into your router’s Port Forwarding settings and forward any outgoing requests for port 8080 to the internal port 8080 on the Raspberry Pi’s local IP address.
Turning the camera on at specific times
The set up so far will make the camera stream stay on for as long as the Raspberry Pi is on. For extra security and privacy, it might be useful to only run the camera stream when you are at work or out of the house. One simple way to make this happen is to make a cron job. Edit the system crontab of the Raspberry:
This will make the livestream turn itself on every weekday (1-5) at 9:30 am and turn itself off every weekday at 4:30 pm. Change the example above as appropriate.
In addition to the steps above I also set up a dashboard so I can more easily control the camera from any computer or phone connected to my local network at home. This was a little bit more involved and might be the topic of a future post.