Skip to content

Instantly share code, notes, and snippets.

@floreo
Created September 24, 2017 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floreo/6d21a42501532c568dd60e67e6875c39 to your computer and use it in GitHub Desktop.
Save floreo/6d21a42501532c568dd60e67e6875c39 to your computer and use it in GitHub Desktop.
Philips HUE alert for GMAIL // make blink a lamp when finding emails
#!/usr/bin/env bash
_mail="" # without the @gmail.com
_password=""
_mailcount="$( curl -u ${_mail}:${_password} --silent "https://mail.google.com/mail/feed/atom" | sed -re 's@.*<fullcount>([0-9]+)</fullcount>.*@\1@' )"
if [ -n "${_mailcount}" ] && [ "${_mailcount}" -gt 0 ] ; then
curl -X PUT -d '{ "alert": "select" }' http://<hub IP>/api/<api key>/lights/<light number>/state &>/dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment