forked from BardRandall/AliceSmartHome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
executable file
·33 lines (27 loc) · 895 Bytes
/
app.py
File metadata and controls
executable file
·33 lines (27 loc) · 895 Bytes
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
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import logging
from dialog import *
app = Flask(__name__)
SMARTHOMESERVER_ERROR = 202
DEVICE_NOT_FOUND = 203
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.secret_key = 'asjdbasidgausg7di73q783fad7fde'
db = SQLAlchemy(app)
app.config.from_object(__name__)
sessionStorage = {}
logging.basicConfig(level=logging.DEBUG, filename='server.log', format='%(asctime)s %(levelname)s %(name)s %(message)s')
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
# STATUSES
MAIN_MENU = 0
ENTER_SMARTHOME_WEBHOOK = 1
ENTER_SMARTHOME_PASSWORD = 2
ENTER_NAME = 3
status_handle = {
ENTER_SMARTHOME_WEBHOOK: new_user_start,
ENTER_SMARTHOME_PASSWORD: old_user_start,
MAIN_MENU: main_menu,
ENTER_NAME: enter_name
}