Created
February 21, 2015 05:08
-
-
Save achterberg/cbd46bc3b9cdb391eed7 to your computer and use it in GitHub Desktop.
(Indigodomotics) Send messages from Indigo to Slack
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
import urllib2 | |
theVar = indigo.variables[1234567890] | |
text = "%s set to %sK" % (theVar.name, theVar.value) | |
# theVar = indigo.devices[1234567890] | |
# text = "Device %s is now %s" % (theVar.name, theVar.onState) | |
# theVar = indigo.schedules[1234567890] | |
# text = "%s" % theVar.name | |
channel = "#indigo" | |
username = "indigo" | |
icon = ":indigo:" | |
url = 'https://hooks.slack.com/services/yourSlackTokenHere' | |
data = 'payload={"channel": "%s", "username": "%s", "text": "%s", "icon_emoji": "%s"}' % (channel, username, text, icon) | |
req = urllib2.Request(url, data) | |
f = urllib2.urlopen(req) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment