Skip to content

Instantly share code, notes, and snippets.

@towo
Created July 22, 2020 09:39
Show Gist options
  • Save towo/f66b4777543fe090a1b49d433afd0466 to your computer and use it in GitHub Desktop.
Save towo/f66b4777543fe090a1b49d433afd0466 to your computer and use it in GitHub Desktop.
MQTT event notification service

Quick event notification thingie to respond to MQTT events; in my case, specifically for the doorbell so I can hear it with headphones on.

Should probably be easily adaptable to fit a more generalized need, and I'll probably do it at a later point.

[Unit]
Description=doorbell notification service
[Service]
ExecStart=/usr/local/bin/doorbell-notification.sh
[Install]
WantedBy=gnome-session-initialized.target
#!/bin/sh
mosquitto_sub -t event/doorbell | while read time; do
notify-send -i /usr/local/share/icons/openhab-logo-square.png "openHAB" "Doorbell rung at ${time}";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment