TPLink KP303 power one outlet at layer

What is the problem?

Searching in the topics for tplink and layer did not provide the answer I am looking for. Sorry if this is a duplicate.

I have a KP303 with 3 outlets and I connected 10 my printer ( Flashforge Creator Pro V.2016), 2- a webcam power supply and 3- an external fan

I can control my KP303 from octoprint and it sees g-code commands ( it does shut the printer correctly after a print

What I want to acheive is to be able to start the external fan on a specific layer or height and I can't find the correct way to make this work

What did you already try to solve it?

Searched on the net and in this forum

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

I have octoprint.version : 1.5.1
OctoPi Version 0.17.0, running on Raspberry Pi 4 Model B Rev 1.2
TP-Link Smartplug (0.9.26) plugin
printer is a flashforge Creator Pro, manual control of my outlets work from the octoprint gui.

Thanks for any help !

The TP-Link plugin doesn't have this capability. You would have to ask the author for an enhancement.

I'm going to guess that you can also control the plugs from the RPi. If so, then one way to do this would be to use another plugin like GCode System Commands. To do this you would edit the gcode file and insert an OCTO command where you want the fan to turn on. Some slicers have post processing extensions or macros that could help automate this.

My Fan Speed Mirror plugin might be used for this if instead of a particular layer or height, you are willing to accept a certain fan speed as your trigger. The script would turn the fan on when the M106 command was above a certain value and off with an M107.

It does do this. There is the @TPLINKON <ip> or M80 <ip> commands that you can use to inject into your gcode, assuming you can do that with your slicer.

Hi, yes it does, there is a gcode trigger

my problem is inserting the right gcode at the right place from the slicer.
But since Octoprint knows at which layer he is, I thought that it could be an info that could be used to trigger to power on

Thanks! I will have a look, might work

@b-morgan
The more I think about it, the more it looks like what I exctly need
This way I would not need to inject g-code and both fans would start at the same time whatever the layer I choose in my slicer.

i installed it, and I will have a look
Thanks !

Ok, it's a system command, not a g-code insert

it's looking for G-code "processing of M80 and M81 commands from gcode to power on/off plug"

not sure if it would work

i'm going to try M80 or @TPLINKON in the Fan speed mirrors settings

That's not going to work. Fan Speed Mirror executes an RPi system command passing the S parameter value of the M106 gcode command as an argument. The RPi won't know what to do with "M80" or "@TPLINKON"

Your choices are either to teach your slicer to insert an M80 or @TPLINKON into the gcode output it creates or write an RPi script that turns the plug on when Fan Speed Mirror calls it with the argument above some threshold (the argument values are 0-255).

To put it another way, the TP-Link plugin and Fan Speed Mirror plugin don't talk to each other.

What slicer are you using?

ok, got it, thanks

I'm using Cura or Octoprint for slicing