Created
September 24, 2017 20:38
-
-
Save floreo/6d21a42501532c568dd60e67e6875c39 to your computer and use it in GitHub Desktop.
Philips HUE alert for GMAIL // make blink a lamp when finding emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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