Grüezi wohl back to you @Ewald_Ikemann
Thanks for looking into it and for your answers. I am also happy that there wasn't a quick solution that I had overlooked...
That looks indeed like one step. In fact, given the fact that a Sonoff switch is programmable and we flash it we could change the Arduino code and include this timer function. Maybe it is even there already, as the Sonoff in its natural form supports scheduled switch off. So you can program it to switch off in like a minute later...
Unfortunately, the ATX provides me another problem, as my printer is a Prusa MK3/MMU it runs on 24V.
The plugin for the temperature controlled shutdown, targets a TPLink device, might need to get that one, though I like seeing how much kWh my printer consumes, the Sonoff I currently use does that. Note that however it does not prevent shutdown when temperature is too high, but at least it schedules it.
Coming to think of it, I think it needs a script that ideally:
- Registers a desired shutdown, either by a button, or from a remotely operated script.
- Ensure that temperature is going down, by aborting an active print
- Schedule a temperature 0 (in case no print was active, but it was e.g. preheating)
- Wait till the temperature is lower then 50 C
- Schedule a timed power off to the external relay device
- shutdown the rpi
The plugin that you pointed out is pretty close and has most building blocks in it, be it there are still pieces missing as far as I can see.
If I take them step by step, in bold the problematic ones:
- register shutdown: a button connected to a GPIO.
- Script: you can run a python script to make the software believe a GPIO is triggered.
- Schedule shutdown: can we abort an octoprint job from the command line? We could abort the whole octoprint, but then we cannot easily monitor the temperture... So it needs to specifically stop streaming print commands.
- Schedule the temperature 0: send one Gcode for doing that.
- Wait till temperature lower then 50C: the plugin could do that.
- Schedule timed out power off to an external relay: your hardwareseems to do exactly that, but it would need to drive a relay.
- shutdown rpi: piece of cake, sudo shutdown now
Maybe there is even something closer out there living in the unknown?