add 2 new routes /api/<version>/current{air,water}temperature
authorgregor herrmann <gregor@toastfreeware.priv.at>
Wed, 5 Sep 2018 21:33:52 +0000 (23:33 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Wed, 5 Sep 2018 21:33:52 +0000 (23:33 +0200)
to get timestamp and value of current temperatures

web/seepark_web.py

index 59e0c8b..b4c7749 100644 (file)
@@ -262,6 +262,18 @@ def openweathermap_city(version, cityid):
     return jsonify(result)
 
 
+@app.route('/api/<version>/currentairtemperature')
+def currentair(version):
+    value, timestamp = currentairtemperature(cityid)
+    return jsonify({"value": value, "timestamp": timestamp})
+
+
+@app.route('/api/<version>/currentwatertemperature')
+def currentwater(version):
+    value, timestamp = currentwatertemperature(mainsensor)
+    return jsonify({"value": value, "timestamp": timestamp})
+
+
 @app.route("/")
 def index():
     airvalue, airtime     = currentairtemperature(cityid)