Octoprint auto power off on thermal runaway using tasmota

I have Home Assistant up and running with a few Tasmota switches, but I’m still really new to all this.
I found this link on setting up OctoPrint to talk to HA:

What I’m ultimately wanting to do is this: If Octoprint faults for whatever reason (communications error, thermal runaway error, etc) I want to have Home Assistant turn the power off of the Tasmota Sonoff switch of that printer - thus shutting everything down safely.
So I have Home Assistant, OctoPrint running on a Raspberry Pi, and a 16Amp Sonoff Tasmota switch. What type of configuration or script or events, etc. (whatever they are called) do I set up to make this happen automatically?
Is there a guide somewhere or someone already done this?
I’ve Googled but not found anything (probably because I’m not using the correct terminology)

Not done it myself, although in the process of setting it up.

  1. Set up Octoprint
    (be sure to configure the binary_sensor for printing error - that will be the thing that you need to find out what the value is (as its a binary_sensor it will likely be either error or no error - so could end up triggering with a small error).
  2. Use an automation that when the binary_sensor is the value that indicates an error, then tell the tasmota switch to turn off (you can either do that by switch.turn_off - or probably send an MQTT straight to it - depends how you have it set up)
1 Like

This is what i use to turn it off after 10 minutes when the print is done.
You can also use the error sensor.

  • alias: Printer uitzetten na printen
    initial_state: ‘off’
    platform: state
    entity_id: binary_sensor.octoprint_printing
    from: ‘on’
    to: ‘off’
    minutes: 10
    • service: switch.turn_off
      entity_id: switch.3d_printer_sonoff