Switching off power

Hi,

I looking for a solution to cut the power supply‘s connection to electricity after printing. I am using a plugin to shut down the raspberry pi after printing by activating it in the gui.

But, is it possible first to shut down the raspberry and a couple of minutes later cutting electricity using a Sonoff?

I know there is a sonoff-plugin, but I think it cuts power directly after print job is done without shutting down the raspberry.

Is there a plugin solution?
And, do I have to flash the sonoff with tasmota?

My TPLink plugin could do this with a combination of gcode triggers, system commands and countdown timer options.I never got around to incorporating the countdown timers option in the tasmota plugin.

1 Like

This is an interesting problem.

  • POST -> /api/system/commands/core/shutdown
  • Wait
  • Shutoff plug

Unfortunately, that takes the TPLink plugin itself out of commission. A cleaner approach is to combine this with a separate daemon.

  • TPLink plugin sends shutdown verb to daemon
    • Daemon then POSTs to OctoPrint shutdown API
    • Waits
    • Daemon then toggles off the TPLink device by proxy for the plugin

Like I said in my previous post, you can do this completely with the tplink plugin and it works fine without any special daemon, etc. The settings below for example would send the off command to the TP Link device instructing it to use the countdown timer built into those devices to power off the printer in 5 minutes. That basically acts as your daemon you mention. Then the system command before off delay triggers the shutdown command of the pi itself after 30 seconds, you just use the same command you would use in octoprint's system shutdown option. And it's all triggered by the gcode trigger options to automate after print completes. At least that's how I remember programming it to work, but honestly haven't gone back and looked or tested since some of the recent strip and energy monitoring updates.

image

2 Likes

So, to be honest, I am looking for a solution for my Sonoff.

If that's the case then I could get my tasmota plugin to work for you I think, but would take some development time and you'd have to flash tasmota to it.

Wow, dude. That's got it covered, then.

Would be very great... I already flashed TASMOTA to some of my SONFFs.
Please keep us informed... would save energy.

@Blebbens, are you currently using one of my Tasmota plugins? If so, which one?

I found octoprint-tasmota.
But, I am still waiting for delivery of my Sonoff POWs R2.

Ok cool, that's my web based version control, the simplest to update. I just pushed some changes to the repository under a separate branch I was developing. If you install the plugin using the url below it should work for your use case with the settings in the screenshot below the link.

https://github.com/jneilliii/OctoPrint-Tasmota/archive/0.8.6.zip

The settings above will basically react to a gcode command of M81 192.168.0.103 1 that you put in your end gcode settings of your slicer or in octoprint's gcode scripts section for after print job completes. The system command will be scheduled to run 30 seconds after which will power off the pi, and then finally the backlog command is used to tell the tasmota/sonoff device to power off in 5 minutes.

2 Likes

Hold off on installing. I just realized that the gcode triggers aren't running the system commands, so will need to adjust that in code. Guess that's a change I did in one of my other power related plugins. Will let you know when it's ready.

Ok, it's all set now. I added the system commands to the gcode processing loop and tested on my windows dev machine and it seems to be working as expected. Let me know.

Okay, I have to change your IP to my sonoff's IP, right ?

So, I found your Octoprint-tasmota-plugin in the official repository and installed it yesterday. I read the description and thought this plugin is able to shut down the power after shutting down the raspberry.

But, now I understood I have to deinstall the plugin for using your URL ?!

You can just install from that url and it will upgrade the version number. Yes, you use your device's ip address.

Hallo!
I am trying to configure my sonoff S20 with tasmota-plugin.
I can now switch the S20 by clicking the lightning-icon in the top bar of octoprint. This works just fine.
But I canot get octoprint to switch off by sending M81. Sending M81 through the console will print
"Send: M81
Recv: ok P15 B3"
but the S20 will not switch.
Did I make any mistakes during configuration?
TasmotaOctoprint|359x500

The command you need to use is M81 <ip of your plug>? for example M81 192.168.0.2.

Thank you!

Continuing the discussion from Switching off power:

Hi, i use a sonoff basic and i'm not able to use countdown timers to turn off the sonoff plug.
When i execute the M81 command, the plug turn off after the delay in GCODE Off Delay but the off delay count down is not applicated.
I don't know why it's not working, any ideas ?

Which plugin are you using and how do you have the settings now for the plug?