summaryrefslogtreecommitdiff
path: root/api.py
diff options
context:
space:
mode:
authorroot <root@turin.home>2022-01-15 14:46:26 +0000
committerroot <root@turin.home>2022-01-15 14:46:26 +0000
commitf315adea703193deb7419355dc084e903dbfde1e (patch)
tree64f0855bd91bf2c8b7cc4d9c9dc5a80a5c448015 /api.py
parentcf70ae6ded332729f0dc2833d6680d7dac8072db (diff)
Development
Diffstat (limited to 'api.py')
-rw-r--r--api.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/api.py b/api.py
new file mode 100644
index 0000000..95dd72b
--- /dev/null
+++ b/api.py
@@ -0,0 +1,30 @@
+@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
+ """
+
+
+@app.route("/api/current_temperature")
+def api_current_temperature():
+ return boiler.temperature
+
+
+@app.route("/api/target_temperature")
+def api_target_temperature():
+ return boiler.target
+
+
+@app.route("/api/heating_on")
+def api_on():
+ return boiler.on