-
Notifications
You must be signed in to change notification settings - Fork 0
/
pimator.py
29 lines (21 loc) · 880 Bytes
/
pimator.py
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
from flask import Flask
from flask import render_template
from flask import redirect
from transmitter import Transmitter
from config import Config
app = Flask(__name__)
config = Config()
transmitter = Transmitter(config)
@app.route('/')
def index_pimator():
return render_template('index.html', codes=config.codes, application_prefix=config.application_prefix)
@app.route('/outlet/<string:outlet>/<string:state>', methods=['POST'])
def apply_state_to_one_outlet(outlet, state):
transmitter.apply_state_to_one_outlet(outlet, state)
return redirect(config.application_prefix, code=302)
@app.route('/outlet/all/<string:state>', methods=['POST'])
def apply_state_to_all_outlets(state):
transmitter.apply_state_to_all_outlets(state)
return redirect(config.application_prefix, code=302)
# if __name__ == "__main__":
# app.run(debug=True, host="0.0.0.0")