Example - Dictation to Announcement

Posted on
Wed Nov 07, 2018 8:56 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Example - Dictation to Announcement

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest