Shutdown printer plugin - TP-Link Smartplug API -can't configure with the new camera stack Octoprint

(edited to mention the correct plugin!)

I have two SD cards that I'm using in my Pi - my original one with the 'standard' Octoprint 1.9.3 install and a newly configured SD card that has1.9.3 new camera stack build. The reason was that my pi camera stopped working on the original and after weeks of trying to fix it I decided to create a new image. The pi camera works with the new stack, but my problem now is that I cannot find a way of adding the TP-Link API into the shutdown printer plugin when using the new SD card/build.

If I put my old SD card in, I can see from the API settings that I have 3 APIs - one for TP-Link, one for Cura and one for Octoapp (I can't remember how I set these up in 2022). In the shutdown printer plugin I can see it uses the TP link API and works as expected. I know from my notes that the TP-Link plug (KP105) is still on the same firmware as when I first installed it (1.07) so in theory I should be able to create a relevant API again, but I cannot find any option to do it, and google searches didn't help me yesterday!

Can someone please advise how I create the trust relationship between the Octoprint new camera stack build and the KP105 smartplug? At the moment I'm running on the old SD card as I prefer to have smartplug control than the camera.

As an aside (different topic just FYI) , with the new camera stack build if I ask cura to request an API it does so but doesn't work (user not recognised).

Thanks
Dave

My plugin doesn't require any API settings so curious what you mean?

Apologies- that's what happens when I type in a hurry! I have your plugin and the 'shutdown printer' plugin...it's that one that uses the tplink API.

I've edited the original post to correct that.

you don't need that other plugin if all you're after is a safe shutdown of the pi.

Thanks, I was hoping that would be the case but when I tried a yesterday I couldn't get the sequence right......
I have TP-Link plugin set to disconnect the printer plug after idle for 2 minutes and the temperature has dropped to 40c. that worked as expected. I also want to then switch off the pi using the 'Run system command before off' and issuing the command "sleep 10s; shutdown -h now" I set the delay to 10 seconds but when I tried it yesterday the pi shut down before the printer. It may have been some other mistake I made (it was late!) so I'll try again tonight and make sure the other plugin is disabled. Reading the pop up notes it reads that the system command will onlky get actioned after the printer plug action has completed.
Your plugin is definitely easier to understand :slight_smile:
Thanks for responding.

I just ran a test and the plugin shut down the TP-link as configured (the TP-Link pug has the printer connected, not the pi). However, the pi stays on after the printer plug has been powered off - even though I have the 'run system command before Off' ticked and the command set to issue "sleep 30s; shutdown -h now" (without the quotes). That command works if I issue it from VNC desktop connection that logs me in as the same user. What am I doing wrong?

I do have another spare TP link that I could use to power the pi, but I would still want the plugin to issue a system shutdown command before switching that plug off.

I realise I've gone sort of off topic from the title, but if I can get the config correct to turn off the printer plug then shut down the pi I wont need to worry about the API :slight_smile:

It's very specific timing as you're starting to figure out. I've documented it for the Tasmota plugin, which is roughly the same settings as TPLink. Check the link here.

I personally never shut off the pi, as it's more convenient to send files to it from the slicer with the printer off and have it auto power on printer for me.