Support for Smart Plug commands like TP-LINK (either directly or via HTTP POST request)


I have my printer setup hooked up to a TP-LINK smartplug which i use to power of the printer after successfull prints. As the current repetier-server does not support sending event based commands (or HTTP requests) i have it working but its a bit fussy and ideally i would love to have a more direct solution out of the repetier-server if possible.

Basically atm it works like this: If a print is completed i get a notification on the repetier infoermer app on android. I then use Automagic app to trigger a HTTP POST request to my TP-LINK smartplug to switch it off.

Ideally i would love to have such a feature (either TP-LINK support or HTTP requests) from within Repetier-Server to issue this command directly without having to resort to my above method which is prone to possible issues (if the phone is off etc).

Octoprint for instance has a dedicated plugin for the TP-LINK smartplug ( which has the option to issue the on/off command triggered by GCODE M80 ip address / M81 ip address. 

Either solution would be fine for me if possible.



  • That would only make sense for us if we can support all smart links and own them for testing.

    None th eless, it is not impossible. That is what the extcommands.xml file is for, please read manual for details. This allows you to add menu entries in printer menu to execute on your pc. It also allows starting a script with @execute server command. So you can even add it in your end event script. Only thing you need to consider is that printer might not be finished when this command gets executed. Typical solution is to add 30 M400 before the @execute line then so printer is finished with everything before that line. The called script should none the less add a 5s pause before turning off power so server can cleanly finish job before printer disconnects.
  • Yes i understand that such a development would only make sense if it would be more widely applicable.

    I also though about the extcommands.xml solution but honestly the documentation on how exactly that works is a bit sparse for me. I am not a linux or python guru so writing a script that creates json or http post commands from scratch is a bit beyond my knowledg. I usually reverse engineer such things if they have been developed for similar purposes and make my own adjustments but i don't know how to write something like this from scratch.
  • If you know the http post command the script is quite easy if you use curl to send it.

    sleep 5
    curl .....

    thats it. Just needs to check curl syntax. Extcommands is just calling the script file then. Only make sure the user repetierserver is allowed to execute it.
  • Hi,

    I have managed to get a script ( that works if i run it manually from ssh. I have added the following command to extcommands but it does not trigger the script no matter if i use it with @execute TPLINKOFF in the event based gcode tab or if i try to run it directly from the menu. What am i missing?

    <execute>sudo /home/pi/ 9999 off</execute>
  • I have also tryed with following format:

    <execute>./ 9999 off</execute>
  • I did some more experimenting. So executing from menu now works however it does not seem to work from event based GCODE (@execute TPLINKOFF).

    <confirm>Really turn off TP Link Plug?</confirm>
    <execute>/home/pi/ 9999 off</execute>
  • Try to make a script without parameter. That might help with the @execute command. Also note that for execute there is a separate section in extcommands. <command> is only for the menu.
  • Thanks for the tip. I didn't even notice the seperate section in extcommands for execute :P Now that you mentioned it i set it up and it works from GCODE command.
  • Everything works fine now. I have added a 5 minute sleep into the script so that the printer has sufficient time to finish enything and everything like converting the timelapses etc before being shut down. It all works flawlessly now.

    Thanks again for your support and tips!
Sign In or Register to comment.