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:
... 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.