Simple flask app to send a magic packet to a device on the network, plus a live webcam video/audio stream from the host.
Install dependencies:
pip install -r requirements.txtAllow the app user to run etherwake without a password prompt:
echo "$USER ALL=(ALL) NOPASSWD: /usr/sbin/etherwake" | sudo tee /etc/sudoers.d/etherwake
sudo chmod 440 /etc/sudoers.d/etherwakeSet the target MAC address(es) in config.ini, then run:
python app.py/webcam shows a live MJPEG video stream and MP3 audio stream from a webcam
plugged into the host, with dropdowns to pick the video/audio source when
more than one is available.
Requirements on the host:
ffmpeginstalled- the app user in the
videoandaudiogroups:sudo usermod -aG video,audio $USER v4l2-ctl(packagev4l-utils) andarecord(packagealsa-utils) for device enumeration — if either is missing, streaming just degrades to "no source available" instead of failing
Capture defaults (resolution, fps, audio bitrate) live in the [WEBCAM]
section of config.ini. If no webcam/microphone is present, / and the
Wake-on-LAN button are unaffected.
To run the app automatically on boot (requires gunicorn in ./bin/):
sudo cp wolbutton.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now wolbuttonThe service listens on port 8000, starts after network-online.target, and
runs a single gunicorn worker with 4 threads (gthread) and no request
timeout — required so the long-lived video/audio streams don't get killed and
don't block the Wake-on-LAN route.
./deploy.sh syncs the repo to the host over rsync, installs any updated
Python dependencies, and restarts wolbutton.service:
./deploy.sh # sync + install deps + restart the service
./deploy.sh --dry-run # show what would be synced, change nothingDefaults to HOST=vpn-gateway and REMOTE_DIR=/home/pi/wolButton; override
with env vars if needed.