-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalexa.py
More file actions
69 lines (60 loc) · 3.69 KB
/
alexa.py
File metadata and controls
69 lines (60 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from flask import Flask
from flask_ask import Ask, statement, question, session
import json
import requests
import time
import unidecode
app = Flask(__name__)
ask = Ask(app, "/")
@ask.launch
def start_skill():
red_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/red_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
green_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/green_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
yellow_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/yellow_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
r_d = red_val.json()
g_d = green_val.json()
y_d = yellow_val.json()
if (y_d['result']) == 0 and (r_d['result'] == 0) and (g_d['result'] == 0):
output_txt = "Entire library is yours to conquer..!!"
elif (r_d['result']) == 0 and (g_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 1st Floor on Green Couches and one on 2nd Floor on Red Couches"
elif (y_d['result']) == 0 and (g_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 1st Floor on Green Couches and one on 2st Floor on Yellow couches"
elif (y_d['result']) == 0 and (r_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 2st Floor on Yellow couches on left and other on Red Couches at the right"
elif r_d['result'] == 0:
output_txt = "There is 1 spot on 2nd Floor on Red Couches at the right end side of entrance"
elif g_d['result'] == 0:
output_txt = "There is 1 spot on 1st Floor on Green Couches at the very end"
elif y_d['result'] == 0:
output_txt = "There is a spot on 2st Floor on Yellow couches on the left side"
else:
output_txt = "Sorry, I could not find anything on 1st and 2nd Floor but you may find something on 3rd or 4th floor"
return statement(output_txt)
@ask.intent("ask_spotty")
def share_headlines():
red_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/red_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
green_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/green_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
yellow_val = requests.get("https://api.particle.io/v1/devices/3c0020000a47353137323334/yellow_val?access_token=79cecc0df866aeeabd18a68f2a7b32b33d54de03")
r_d = red_val.json()
g_d = green_val.json()
y_d = yellow_val.json()
if (y_d['result']) == 0 and (r_d['result'] == 0) and (g_d['result'] == 0):
output_txt = "Entire library is yours to conquer..!!"
elif (r_d['result']) == 0 and (g_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 1st Floor on Green Couches and one on 2nd Floor on Red Couches"
elif (y_d['result']) == 0 and (g_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 1st Floor on Green Couches and one on 2st Floor on Yellow couches"
elif (y_d['result']) == 0 and (r_d['result'] == 0):
output_txt = "Ther are 2 spots, one on 2st Floor on Yellow couches on left and other on Red Couches at the right"
elif r_d['result'] == 0:
output_txt = "There is 1 spot on 2nd Floor on Red Couches at the right end side of entrance"
elif g_d['result'] == 0:
output_txt = "There is 1 spot on 1st Floor on Green Couches at the very end"
elif y_d['result'] == 0:
output_txt = "There is a spot on 2st Floor on Yellow couches on the left side"
else:
output_txt = "Sorry, I could not find anything on 1st and 2nd Floor but you may find something on 3rd or 4th floor"
return statement(output_txt)
if __name__ == '__main__':
app.run(debug=True)