A lightweight Flask-based webhook server triggered by HomeKit-compatible Onvis buttons via Homebridge. Each button event is routed to an HTTP API call or local shell script, defined in a config.yml file.
- HomeKit support via Eve or Homebridge dummy switches
- Button events POST to local Flask API
- YAML-based routing to:
- External REST APIs
- Local shell scripts
- Runs as a persistent macOS Launch Agent
git clone https://github.com/chrisbergeron/homekit-button-onvis.git
cd homekit-button-onvis
python3 -m venv cb
source cb/bin/activate
pip install -r requirements.txt# config.yml
button1:
type: api
url: http://localhost:7000/hello
method: POST
headers:
Content-Type: application/json
body: '{"event": "button1"}'
button2:
type: shell
command: "/usr/local/bin/script.sh arg1"python onvis_webhook.py --config config.ymlTest directly to the python app and port (5055):
curl -XPOST http://localhost:5055/api/onvis/button4
{"status":"ok"}This calls the /button4 API route configured in the config.yml file:
# Disable Pihole
button4:
type: api
url: "http://gpserver:7676/admin/api.php?disable=300&auth=z95x6e5c4a17d1ce58eb420a998d69dfd285e0e7c639706c715335d784e47f7dbff4cd7f6e"
method: GETWe can see that it accepted GET as a scheme instead of POST, which is fine for our use (just invoking it with no payload).
- Copy or symlink the plist:
ln -s "$(pwd)/com.chrisbergeron.homekitbutton.plist" ~/Library/LaunchAgents/- Load it:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.chrisbergeron.homekitbutton.plist- Restart later with:
launchctl kickstart -k gui/$(id -u)/com.chrisbergeron.homekitbuttonTrigger a button manually:
curl -X POST http://localhost:5055/api/onvis/button1tail -F ~/Library/Logs/onvis_webhook.log
tail -F ~/Library/Logs/onvis_webhook.err- Edit
config.ymlto add buttons or change behavior - Restart the process after config changes:
launchctl kickstart -k gui/$(id -u)/com.chrisbergeron.homekitbutton- To test the Python entry manually:
cb/bin/python3 onvis_webhook.py --config config.ymlMIT — © 2025 Chris Bergeron
74debcf5-c182-4d92-9f1e-42f0799c9bff