Octopi Safety Autoshutoff

What is the problem?
I am trying to setup an auto shutdown procedure that will turn off my printer when some analog sensors (Carbon Monoxide and Temperature) read too high. Right now I have all of the sensor part of the build mostly completed, right now I am wondering whats the easiest way to set this up to attach it to Octoprint.

What did you already try to solve it?
My original idea was to have one startup script that just checks the values and then would turn off a relay if any value went too high (If anyone knows where I should put the command to run the script that would be great). I also wanted to integrate some of the features into the UI, using this post I tried to configure a power on and power off button which worked fine but I cant seem to figure out how to send the sensor data to the UI using the output from the sensors. I was trying to see if I can just print something in python as a return but it does not seem to work.

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, what kind of hardware precisely, ...)

Octoprint Version: 1.3.11
Octopi Version: 0.16.0

Plugins Installed:

  • Custom Control Editor
  • GCODE System Commands
  • Polar Cloud

You'd have to develop a plugin in order to display the sensor data. Not sure if any of these plugins includes the display of sensor data, but they appear to allow for reacting/controlling them. I'd specifically look into the enclosure plugin.

Some of them do have the plugin for temperature but I am also monitoring smoke sensors which need a calibration script that I setup, I right now I have the pi send an email to me which I setup to send me a snapshot of the camera too. Right now I am trying to make the python script run at start up whenever the pi starts and also start a stream to youtube. I have the commands setup if I paste them in console but I cant figure out where to paste them in one of the config files.