Skip to content

Repository files navigation

WOL Button

Simple flask app to send a magic packet to a device on the network, plus a live webcam video/audio stream from the host.

Setup

Install dependencies:

pip install -r requirements.txt

Allow 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/etherwake

Set the target MAC address(es) in config.ini, then run:

python app.py

Webcam streaming

/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:

  • ffmpeg installed
  • the app user in the video and audio groups: sudo usermod -aG video,audio $USER
  • v4l2-ctl (package v4l-utils) and arecord (package alsa-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.

Systemd service

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 wolbutton

The 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.

Deploying

./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 nothing

Defaults to HOST=vpn-gateway and REMOTE_DIR=/home/pi/wolButton; override with env vars if needed.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages