Creating a network camera with a Raspberry Pi and Raspberry Pi camera module. Tested with Raspberry Pi Zero 2w and Camera Module 3 but wull likely work with most Raspberry Pi's. Stream can be accessed via VLC on another machine or Home Assistant.
VLC
sudo apt upgrade && sudo apt update
sudo apt install vlc
Stream via http
libcamera-vid -t 0 --framerate 30 --inline -o - | cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264
To run on boot
sudo nano /etc/systemd/system/stream.service
[Unit]
Description=Stream service
After=network.target
[Service]
User=username
ExecStart=/bin/bash -c "libcamera-vid -t 0 --framerate 15 --inline -o - | cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264"
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl enable stream.service
sudo systemctl start stream.service
To access on VLC go to file, network stream, then enter http://<ip-of-rpi>:8090
Generic Camera Integration in Home Assistant