Type text on computer - echo speaks it


#1

I have 4 echo speakers around the house and Echo Speaks installed and working. This piston / python script combination allows me to type messages on my computer / ipad and have them read out on my choice of echo at home.

Example use - when my wife isn’t answering her phone because she’s left it in another room I can send a broadcast message to the echos asking her to call me.

To set up:

  • Alter the switch statement in the piston so that each echo is listed as a numbered option.
  • Alter the print statement in the python to create a menu that corresponds to the echos listed in the piston.
  • Change the url on the last line of the python to your own webcore execute endpoint (dashboard / settings / integrations) and replace pistonID with the actual id of the piston from it’s url. Keep the colons.

To use:
Run the python script - it sends a web request to the piston and generates the speech on your speaker.
I have Pythonista on my iOS devices so can run it from there too.

Python Script:

from urllib.request import urlopen
from urllib.parse import quote

print('\nAlexa Broadcast System\n')
print('\nWhich echo do you want to deliver your message?\n')
print('1 - Kitchen\n2 - Living Room\n3 - TV Room\n4 - Bedroom\n5 - All Devices')
echo = input('> ')

text = input("\nWhat do you want Alexa to say?\n")

# Make the query string and urlencode the speech
dataencoded = 'echo={echo}&a={speech}'.format(echo=echo, speech=quote(text))

urlopen('EXECUTE_ENDPOINT_WITH_PISTON_ID?' + dataencoded)