Use TPLink smart plug with Mainsail.
see link below:
moonraker/configuration.md at master · Arksine/moonraker
Link to Moonraker's power module config
This is the one piece that I was really missing form Octoprint. The plugin that handled the TPLink wifi smart plug that my printer is connected to. In order to make this work, we need to use two GitHub Repos.
First, we are going to need to find the IP of your TP Link smart plug. The easiest way is to use the Fing app
Before you plug your smart plug to the wall, do a first scan of your network with Fing. Then plug it into the wall, wait for it to turn on and connect and scan again. the extra IP that pops up is your plug! Note that IP for later...
The first one is https://github.com/softScheck/tplink-smartplug copy it to your Raspberry pi via SSH with:
git clone https://github.com/softScheck/tplink-smartplug
(make sure you already have git installed otherwise do:
sudo apt-get install git -y)
git clone https://github.com/Raabi91/powermanager
open the moonraker.config and put the power devices in it
sudo nano /home/pi/moonraker.conf
put this at the end of the file.
Old code from previous Moonraker version below
#devices: printer, led
#printer_name: My Printer Name here
#led_name: Auto Shutdown
Rename the printer to whatever you want. Then
Time to install powermanager
and edit powermanager's config.
sudo nano /home/pi/powermanager/config.sh
In the config change the two lines for
printer_on(line 5 and 7) to :
printer_off="/home/pi/tplink-smartplug/tplink_smartplug.py -t 192.168.1.XXX -c off"
printer_on="/home/pi/tplink-smartplug/tplink_smartplug.py -t 192.168.1.XXX -c on"
use your plug's IP that we noted earlier. Then
Now you need to restart your Pi. You can do that in Mainsail by clicking HOST REBOOT in settings or via SSH with:
You're done! You can now setup Klipper to reconnect when it detects the MCU being powered on by following my other tutorial: