Skip to content

Commit e77a379

Browse files
committed
Added route for reset, exposed log file to outside
1 parent 4dafeb7 commit e77a379

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

api.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,16 @@ def resetDefaultPrograms():
204204
with open("data/defaults/programs/" + filename) as p:
205205
q = p.read()
206206
programs.insert(json.loads(q))
207+
208+
## Reset
209+
def reset():
210+
pi = pigpio.pi('localhost')
211+
pi.write(BUTTON_PIN, 0)
212+
pi.write(BUTTON_PIN, 1)
213+
with open('/home/pi/log/reset_trigger_service.log', 'r') as log_file:
214+
data = [x for x in log_file.read().split('\n') if x]
215+
216+
return {
217+
"log": data,
218+
"status": "ok"
219+
}

v2.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ paths:
179179
responses:
180180
200:
181181
description: "Bot status"
182+
/reset:
183+
get:
184+
operationId: "api.reset"
185+
summary: "Reset coderbot by restoring boot partition"
186+
tags:
187+
- Coderbot reset
188+
responses:
189+
200:
190+
description: "reset log file"
182191
/stop:
183192
post:
184193
operationId: "api.stop"

0 commit comments

Comments
 (0)