I made an account at openai, entered the following code (which uses python shell scripting node.js code) from the "Alexa Command" Indigo implementation. Check the code, then check thr GPT-3 output below!
- Code: Select all
#Python 3
import indigo
import subprocess
import time
debug = False
announcement = indigo.variables[1330859711].value # Variable which contains text to speak
echo = "Kitchen Echo Show" # "ALEXACOMMAND_destination"
indigo.server.log (u'NODEJS [Announcement] = {} [Destination] = {}'.format(announcement, echo))
#echospeakerlist = echospeakerstring.split(",")
#for echo in echospeakerlist: TOO SLOW
command = u'node ~/Desktop/Alexa/send-alexa-command.js "ssml" "{}" "{}"'.format(announcement, echo)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if debug:
try:
# Filter stdout
for line in iter(p.stdout.readline, ''):
sys.stdout.flush()
# Print status
indigo.server.log (">>> " + line.rstrip())
sys.stdout.flush()
except:
sys.stdout.flush()
# Wait until process terminates (without using p.wait())
loop_count = 0
while p.poll() is None:
# Process hasn't exited yet, let's wait some
time.sleep(0.5)
loop_count += 1
indigo.server.log (u'NODEJS Poll Loop Count = {}, Return Code = {}'.format(loop_count, p.returncode))
Here is the output:
- Code: Select all
# Explanation of what the code does
# 1. The script is called by the Indigo server
# 2. The script reads the text to speak from the Indigo variable
# 3. The script calls the nodejs script to send the text to the Alexa device
# 4. The nodejs script sends the text to the Alexa device
Tell me that's not insane!
Edit: The Q&A section
Q: How do I add a new device in Indigo Domotics?
(Below is the response, a little off, but trying)
A: To add a new device in Indigo Domotics, open the Devices tab in the Indigo application and click the "+" button in the bottom left corner. Then, select the type of device you want to add and follow the on-screen instructions.