Your webcam works hard to capture a live feed and work some digital magic to take what it sees and shares it with a video recorder or meeting software. Like any peripheral or PC component, the webcam won't last forever. There will come a time when you need to replace it with a better model or one that will offer better reliability with new parts. Instead of throwing the old one away, you can repurpose it for other uses. Here's how I've used an old webcam inside my smart home.
3 Detect motion for automations
Home Assistant is your friend
Home Assistant is one powerful tool for your smart home arsenal. It's the foundation of a smart home, bringing together everything that could be considered "smart," including bulbs, sensors, and even your smartphone. Everything can be interlinked and integrated into Home Assistant with countless plugins and additional content to make some seriously cool home automation. Your webcam can be part of this project by taking a live feed and using it as a means to activate a detection condition and trigger automations.
MotionEye is a capable plugin that can take live feeds from webcams and then pass them through to Home Assistant as video or for motion detection. With this input, you could switch on some lights if the device detects motion or even ping your phone with an alert. It's pretty neat and ties into the plethora of ways you can use Home Assistant to perform various tasks. I always felt the "smart home" label was nothing more than pointless marketing for products to be sold, but that all changed when I installed and configured Home Assistant.

Related
How to make a security camera with a Raspberry Pi
A simple DIY project to monitor your surroundings
2 Create a live stream

Source: Pixabay
Need to keep an eye on your pet or some belongings at home? Want to simply record some footage and share it over the network? That's possible with an old webcam and some recording software. This could be in the form of OBS Studio (highly recommended) for sharing it on YouTube and Twitch, VLC for streaming through direct access, and over the network using MJPG-Streamer. All you need is a Raspberry Pi for the last option, but a PC is recommended for OBS and VLC.
Whether you fancy yourself as the next Ninja superstar on Twitch or wish to stream a live feed to keep tabs on something, a webcam can prove invaluable for getting high-quality capture of just about anything, so long as it's within range of a system to power the device.

Related
How to reduce lag when using OBS Studio on an older gaming PC
You can drastically improve your OBS Studio recordings by changing these simple settings
1 Indoor security camera
Alert to any intruders
This is probably the least unique way to reuse an old webcam, but it's arguably the most important as we look to secure our homes from unauthorized access. Security cameras are fantastic. IP cameras are used throughout the home, both inside and out, but I've also plugged in an old webcam for keeping tabs on anyone accessing the cabinet. It's better since I don't need this camera to go through the network, which helps free up a slot on my PoE-capable switches, as well as keeping as much off the LAN as possible.
Using the direct USB connection, I can use the webcam as it was designed for, but in a slightly different way. Another handy way of using webcams is placing them in locations where such a device would typically be present, helping to mask the security nature, since anyone who shouldn't be there would spot what looks like a security camera. A webcam could be overlooked, especially if the live feed indicator is inconspicuous or (better yet) not present.
Make use of older hardware
Most of the tech in my home lab is either used or repurposed hardware. This is great for not only cutting down on costs, since IP cameras can range between $50 and a few hundred, but it also keeps as much e-waste out of the household waste system as possible. Webcams won't be useful forever, since you may need a new feature only found in newer hardware, or you simply wish to replace an aging product to ensure reliability.
That's where your smart home can take the older webcam and use it for a few more years. We've covered Home Assistant right here on XDA extensively, publishing some in-depth guides on using such a platform to create some wacky and useful solutions to various smart home-related issues. You're only limited by your imagination (and available budget), but saving money through repurposing old hardware makes all this more accessible.