Notify Me Alexa Skill Script

Posted on
Tue May 01, 2018 2:43 pm
jay (support) offline
Site Admin
User avatar
Posts: 15598
Joined: Mar 19, 2008
Location: Austin, Texas

Notify Me Alexa Skill Script

As pointed out elsewhere on our forums, there is a cool new Alexa Skill called Notify Me. This skill allows you to send notification messages to your Alexa devices. If you've not yet experienced Alexa notifications, when a notification is received to your Amazon account, the LED on all your Alexa devices will blink/pulse yellow and a chime will sound. This indicates that you have waiting notifications. You can then say "Alexa, play notifications" and it will read all notifications that are waiting.

The Notify Me Alexa Skill allows anything (like Indigo) to send notifications to your Alexa devices using a fairly simple HTTP call. To use with Indigo, execute this script (either as a standalone script file or from an embedded script action):

Code: Select all
import json, requests

# Get the access code from an Indigo variable - you could also just
# paste in the string, but this is much more reusable. Just create
# a new Indigo variable (name doesn't matter) and paste in the
# access code you got in the email from and
# use that varible's ID here
access_code = indigo.variables[1191967004].value # ID of variable with access code

# This example shows how to insert a device state into the message.
current_temp = int(indigo.devices[1250026703].states["temperature_F"])
notification_string = "The current temperature is {} degrees".format(current_temp)

body = json.dumps({
    "notification": notification_string,
    "accessCode": access_code,
})"", data=body)

For instance, in an Execute Script action:

ss175.png (158.94 KiB) Viewed 560 times

This script illustrates how to use a device state in the message that's read to you, but of course you can also insert variable values, etc. The script above also expects the access code to be stored in an Indigo variable. We did that for a couple of reasons: first, it's easier to change it in just one place in case it ever changes and second if you have multiple Amazon accounts with Alexa devices attached you can have multiple variables with each access code.

This could have been made into a plugin, but the script is so simple I thought it probably wasn't worth the effort. Someone else may do it however... :)

Have fun!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest