Skip to content

Commit

Permalink
Just minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Priddy committed Jul 29, 2015
1 parent 579a918 commit d4bc410
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 10 deletions.
12 changes: 12 additions & 0 deletions IntentSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"intents": [
{
"intent": "HelloWorldIntent",
"slots": []
},
{
"intent": "HelpIntent",
"slots": []
}
]
}
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

# EchoPy
A python based Hello World demo Amazon Echo.

## Requirements and setup
EchoPy is built using python with flask. Amazon also requires that the server running the code be publicly accessible on port 443 using https. This means that you will either have to host it on a VPS or port forward 443 from your router.

### Local development environment
Your computer or virtual environment needs the following installed before you go any further:

* Python
* [PIP](https://pip.pypa.io/en/stable/installing.html)

To run EchoPu, you'll need the python packages specified in [requirements.txt](./requirements.txt).

Once you have the above requirements installed on your computer, clone this repository, and run the following from the project root to get the environment setup for running EchoNestPy:

1. `pip install -r requirements.txt`


### Setting Up Server

The Alexa Skills Kit (ASK) requires that the server has an open connection to the internet on port 443 (HTTPS) with a SSL Certificate (self signed is okay). Right now this runs in flask with out HTTPS but I am looking into changing this. One way to work around this is to use STunnel4 or ngix forwarding to accept connections on 443 and connect to the app on port 5000.

### Setting Up Alexa Skills Kit on Amazon

The ASK is available at: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/getting-started-guide

2. Sign in or Create an Account.
2. Go to Apps & Services at the top of the page
2. Click on Alexa
2. Click Add New Skill
2. Fill out the first form:
** Name: Anything you want it to be - I use Nest Control
** Invocation Name: The hotword to call the app - I have gotten it working with Demo Hello
** Version: 1.0 <- This is hard-coded for now
** Endpoint: https://<domain or ip address\>/alexa/EchoPyAPI
2. Go to the next page and copy the intentSchema.json to the Intent Schema and sampleUtterances.txt to the Sample Utterances
2. Go to the next page and upload the self signed SSL Cert you have.. and hit next..

## Usage
````
run: python echopy.py
````

At this time you will have to go to your Echo and say 'Alexa, Talk to Demo Hello' (Replace Nest with what the Invocation Name you set).


24 changes: 24 additions & 0 deletions SampleUtterances.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
HelloWorldIntent say hello
HelloWorldIntent say hello world
HelloWorldIntent hello
HelloWorldIntent say hi
HelloWorldIntent say hi world
HelloWorldIntent hi
HelloWorldIntent how are you

HelpIntent help
HelpIntent help me
HelpIntent what can I ask you
HelpIntent get help
HelpIntent to help
HelpIntent to help me
HelpIntent what commands can I ask
HelpIntent what commands can I say
HelpIntent what can I do
HelpIntent what can I use this for
HelpIntent what questions can I ask
HelpIntent what can you do
HelpIntent what do you do
HelpIntent how do I use you
HelpIntent how can I use you
HelpIntent what can you tell me
12 changes: 11 additions & 1 deletion echopy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#! /usr/bin/python
#################################################
# Alexa Skills Kit Hello World #
#################################################
# Zachary Priddy - 2015 #
# me@zpriddy.com #
# #
# Features: #
#################################################
#################################################

import os
import echopy_app
import echopy_doc
Expand Down Expand Up @@ -26,7 +37,6 @@ def apicalls():

def run_echopy_app():
import SocketServer
#SocketServer.BaseServer.handle_error = close_stream
SocketServer.ThreadingTCPServer.allow_reuse_address = True
echopy_app.run(app)

Expand Down
10 changes: 10 additions & 0 deletions echopy_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#! /usr/bin/python
#################################################
# Alexa Skills Kit Hello World #
#################################################
# Zachary Priddy - 2015 #
# me@zpriddy.com #
# #
# Features: #
#################################################
#################################################
def run(app):

try:
Expand Down
28 changes: 19 additions & 9 deletions echopy_helloworld.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#! /usr/bin/python
#################################################
# Alexa Skills Kit Hello World #
#################################################
# Zachary Priddy - 2015 #
# me@zpriddy.com #
# #
# Features: #
#################################################
#################################################

import json
appVersion = 1.0

Expand Down Expand Up @@ -51,26 +62,25 @@ def intent_request(session, user, request):

card_type = "Simple"
card_title = "HelloWorld - Title"
card_content = "HelloWorld - Content"
card_content = "HelloWorld - Hi"

response = {"outputSpeech": {"type":output_type,"text":output_speech},"card":{"type":card_type,"title":card_title,"content":card_content},'shouldEndSession':True}

return response
'''
elif request['intent']['name'] == "NestSetIntent":
nestTempValue = request['intent']['slots']['temp']['value']
output_speech = "Telling Nest to cool to " + str(nestTempValue) + " degrees fahrenheit"

elif request['intent']['name'] == "HelpIntent":
output_speech = "This is the Hello World help! Just say Hi "
output_type = "PlainText"

card_type = "Simple"
card_title = "HelloWorld - Setting Nest Temp"
card_content = "Telling Nest to cool to " + str(nestTempValue) + " degrees fahrenheit."
card_title = "HelloWorld - Title"
card_content = "HelloWorld - This is the Hello World help! Just say Hi"

response = {"outputSpeech": {"type":output_type,"text":output_speech},"card":{"type":card_type,"title":card_title,"content":card_content},'shouldEndSession':True}
response = {"outputSpeech": {"type":output_type,"text":output_speech},"card":{"type":card_type,"title":card_title,"content":card_content},'shouldEndSession':False}

return response

'''

else:
return launch_request(session, user, request) ##Just do the same thing as launch request

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask>=0.9
requests

0 comments on commit d4bc410

Please sign in to comment.