Example - Dictation to Announcement

Share your macOS, iOS, and iPadOS shortcuts here. Post your shortcut in a new topic and be sure to describe thoroughly (screenshots, full text of any scripts, apps used, etc).
User avatar
mundmc
Posts: 1068
Joined: Fri Sep 14, 2012 4:34 pm

Example - Dictation to Announcement

Post by mundmc »

Use case: Say something to Siri, broadcast that message throughout the house
Requirements: Shortcuts, Pythonista, a Trigger that speaks the contents of a variable when that variable is changed, a creative PA system

Let’s DO this thing!

DiffComp, you had a good example of SSH’ing into your host to run a script, throw it up here!

Here’s my workflow that uses Pythonista to take dictation and make announcements at home when I’m away:
Image
... and the Pythonista code:

Code: Select all

 #! /usr/bin/env python2.7
# -*- coding: utf-8 -*-

from sys import argv
import requests
from requests.auth import HTTPDigestAuth

print argv[1]

url = 'http://INDIGOSERVERADDRESS:8176/variables/SPEECH_simonsays?_method=put&value='+argv[1]

try:
	response = requests.get(url, auth=HTTPDigestAuth('INDIGOUSERNAME', 'INDIGOPASSWORD'))
	print response.content
except KeyError, error:
	indigo.server.log(u"restful_api_example.py KeyError: %s" % error, isError=True)

except TypeError, error:
	indigo.server.log(u"restful_api_example.py TypeError: %s" % error, isError=True)

except ValueError, error:
	indigo.server.log(u"restful_api_example.py ValueError: %s" % error, isError=True)

except Exception, error:
	indigo.server.log(u"restful_api_example.py Error: %s" % error, isError=True)




Sent from my iPhone using Tapatalk

Moderator's Note: Adds "Example" to the title.

Return to “Apple Shortcuts”