Added external system commands support for events
Print start, print end, print cancel, and Z height change can now trigger external system commands. These are set in config.yaml and take _FILE_, _PERCENT_, _LINES_ and _ZHEIGHT_ tokens to be passed to external commands. system_commands: cancelled: echo cancelled _FILE_ at _PROGRESS_ percent done. print_done: echo done with _FILE_ print_started: echo starting _FILE_ z_change: echo _LINE_ _PROGRESS_ _ZHEIGHT_master
parent
957213321e
commit
3b66f63ff2
1112
octoprint/printer.py
1112
octoprint/printer.py
File diff suppressed because it is too large
Load Diff
|
@ -375,7 +375,15 @@ def getSettings():
|
||||||
},
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"actions": s.get(["system", "actions"])
|
"actions": s.get(["system", "actions"])
|
||||||
|
},
|
||||||
|
"system_commands": {
|
||||||
|
"print_done": s.get(["system_commands", "print_done"]),
|
||||||
|
"cancelled": s.get(["system_commands", "cancelled"]),
|
||||||
|
"print_started": s.get(["system_commands", "print_started"]),
|
||||||
|
"z_change": s.get(["system_commands", "z_change"])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@app.route(BASEURL + "settings", methods=["POST"])
|
@app.route(BASEURL + "settings", methods=["POST"])
|
||||||
|
@ -417,6 +425,12 @@ def setSettings():
|
||||||
if "system" in data.keys():
|
if "system" in data.keys():
|
||||||
if "actions" in data["system"].keys(): s.set(["system", "actions"], data["system"]["actions"])
|
if "actions" in data["system"].keys(): s.set(["system", "actions"], data["system"]["actions"])
|
||||||
|
|
||||||
|
if "system_commands" in data.keys():
|
||||||
|
if "z_change" in data["system_commands"].keys(): s.set(["system_commands", "z_change"], data["system_commands"]["z_change"])
|
||||||
|
if "print_started" in data["system_commands"].keys(): s.set(["system_commands", "print_started"], data["system_commands"]["print_started"])
|
||||||
|
if "cancelled" in data["system_commands"].keys(): s.set(["system_commands", "cancelled"], data["system_commands"]["cancelled"])
|
||||||
|
if "print_done" in data["system_commands"].keys(): s.set(["system_commands", "print_done"], data["system_commands"]["print_done"])
|
||||||
|
|
||||||
s.save()
|
s.save()
|
||||||
|
|
||||||
return getSettings()
|
return getSettings()
|
||||||
|
|
|
@ -69,7 +69,13 @@ default_settings = {
|
||||||
"controls": [],
|
"controls": [],
|
||||||
"system": {
|
"system": {
|
||||||
"actions": []
|
"actions": []
|
||||||
}
|
},
|
||||||
|
"system_commands": {
|
||||||
|
"z_change":None,
|
||||||
|
"print_started":None,
|
||||||
|
"cancelled":None,
|
||||||
|
"print_done":None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
valid_boolean_trues = ["true", "yes", "y", "1"]
|
valid_boolean_trues = ["true", "yes", "y", "1"]
|
||||||
|
|
Loading…
Reference in New Issue