From 54b65188bd30e245db6134a0718fd1650cd4fdba Mon Sep 17 00:00:00 2001 From: jbruce12000 Date: Sat, 22 Dec 2018 11:24:12 -0500 Subject: [PATCH] - adding stop to api --- api.md | 2 ++ kiln-controller.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/api.md b/api.md index 066b661..b9dea84 100644 --- a/api.md +++ b/api.md @@ -7,3 +7,5 @@ curl -d '{"cmd":"run", "profile":"cone-05-lo"}' -H "Content-Type: application/js curl -d '{"cmd":"run", "profile":"cone-05-lo","startat":60}' -H "Content-Type: application/json" -X POST http://0.0.0.0:8081/api +# stop a schedule +curl -d '{"cmd":"stop"}' -H "Content-Type: application/json" -X POST http://0.0.0.0:8081/api diff --git a/kiln-controller.py b/kiln-controller.py index 7b38f26..b5a8978 100755 --- a/kiln-controller.py +++ b/kiln-controller.py @@ -67,6 +67,11 @@ def handle_api(): profile = Profile(profile_json) oven.run_profile(profile,startat=startat) ovenWatcher.record(profile) + + if bottle.request.json['cmd'] == 'stop': + log.info("api stop command received") + oven.abort_run() + return { "success" : True } def find_profile(wanted):