Skip to content

Instantly share code, notes, and snippets.

@martinj
Created December 19, 2019 21:50
Show Gist options
  • Save martinj/468045bce4f2b9bd299470c5382e006a to your computer and use it in GitHub Desktop.
Save martinj/468045bce4f2b9bd299470c5382e006a to your computer and use it in GitHub Desktop.
Turn off printer on thermal runaway
# What i added to ~/.octoprint/config.yaml
events:
enabled: true
subscriptions:
- command: ~/on-thermal-error.sh "{error}"
event: Error
type: system
#!/bin/bash
REGEX="kill\(\)"
if [[ $1 =~ $REGEX ]]; then
# Turn off WIFI plug (Sonoff S26, running https://github.com/arendst/Tasmota)
curl http://192.168.X.XX/cm?cmnd=Power%20off
# Send notification to phone using IFTTT
curl -X POST -H "Content-Type: application/json" -d '{"value1":"'"$1"'","value2":"Printer killed"}' https://maker.ifttt.com/trigger/octoprint_error/with/key/xxxx
else
# Octoprint received error but it doesnt look firmware was killed
# Send notification to phone using IFTTT
curl -X POST -H "Content-Type: application/json" -d '{"value1":"'"$1"'","value2":"No Action Taken"}' https://maker.ifttt.com/trigger/octoprint_error/with/key/xxx
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment