2022-12-15 12:13:09 +00:00
|
|
|
from flask import Flask
|
|
|
|
from flask_restful import Api
|
2022-12-15 16:59:47 +00:00
|
|
|
from Routes import water, heating, poll
|
2022-12-15 12:13:09 +00:00
|
|
|
app = Flask(__name__)
|
|
|
|
api = Api(app)
|
|
|
|
|
2022-12-15 16:59:47 +00:00
|
|
|
@app.route('/poll_genie')
|
|
|
|
def poll_genie():
|
|
|
|
return poll.poll_genie()
|
2022-12-15 12:13:09 +00:00
|
|
|
|
|
|
|
@app.route('/water')
|
|
|
|
def water_root():
|
|
|
|
return water.get_water_root()
|
|
|
|
|
|
|
|
@app.route('/water/status')
|
|
|
|
def water_status():
|
|
|
|
return water.get_water_status()
|
2022-12-15 14:51:58 +00:00
|
|
|
|
|
|
|
@app.route('/water/boost', methods = ['POST'])
|
|
|
|
def boost_water():
|
|
|
|
return water.boost_water()
|
|
|
|
|
|
|
|
@app.route('/water/turn_off', methods = ['POST'])
|
|
|
|
def turn_off_water():
|
|
|
|
return water.turn_off_water()
|
|
|
|
|
2022-12-15 12:13:09 +00:00
|
|
|
|
|
|
|
@app.route('/heating')
|
|
|
|
def heating_root():
|
|
|
|
return heating.get_heating_root()
|
|
|
|
|
|
|
|
@app.route('/heating/status')
|
|
|
|
def heating_status():
|
|
|
|
return heating.get_heating_status()
|
|
|
|
|
2022-12-15 14:51:58 +00:00
|
|
|
@app.route('/heating/turn_on', methods = ['POST'])
|
|
|
|
def turn_on_heating():
|
|
|
|
return heating.turn_on_heating()
|
|
|
|
|
|
|
|
@app.route('/heating/turn_off', methods = ['POST'])
|
|
|
|
def turn_off_heating():
|
|
|
|
return heating.turn_off_heating()
|
|
|
|
|
|
|
|
|
2022-12-15 12:13:09 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(host='0.0.0.0') # run our Flask app
|