Created
December 19, 2019 21:50
-
-
Save martinj/468045bce4f2b9bd299470c5382e006a to your computer and use it in GitHub Desktop.
Turn off printer on thermal runaway
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What i added to ~/.octoprint/config.yaml | |
events: | |
enabled: true | |
subscriptions: | |
- command: ~/on-thermal-error.sh "{error}" | |
event: Error | |
type: system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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