from __main__ import app from __main__ import boiler @app.route("/api/info") def api_info(): msg = """
You can access data with the api. There are multiple api routes to
get data. They are all in the format of [ip address]/api/[data]
[ip] is used for the device ip address
[ip]/api/current_temperautre
returns the current actual temperature
[ip]/api/target_temperature
returns the current target temperature
[ip]/api/on
returns True if the heating is off and False if it is off
"""
return msg
@app.route("/api/current_temperature")
def api_current_temperature():
return str(boiler.temperature)
@app.route("/api/target_temperature")
def api_target_temperature():
return str(boiler.target)
@app.route("/api/heating_on")
def api_on():
return str(boiler.on)