https://torte71.github.io/InsideSovolKlipperScreen/shutdown.html
Do not simply power off the device by the switch.
Shut it down using either the web interface or the buttons on the KlipperScreen first.
Just powering it off can -and does- lead to damaged files.
I am using a set of batch files to power my printer on and off safely by first sending a “shutdown” command to the device via ssh (actually Putty's plink.exe) and then sending a shutdown command to my hs110 wifi power plug.
(Actually it is first checked, if the device is powered on (reacts to “ping”). If it does not respond, the hs110 is powered off immediately. Otherwise a “shutdown” command is issued to the device and the script waits until the device stops responding to “ping”. After an additional pause of 7 seconds, the hs110 is finally powered off).
These scripts are not limited to Sovol's KlipperScreen, they can be used with any hardware running linux (they do not even depend on klipper). Just make sure to a) adjust the variable PRINTER
in mks_poweroff.cmd
and shutdown_sv06.cmd
to the name or IP-address of your device and b) adjust the variable USERNAME
in mks_poweroff.cmd
to the username on your device.
hs110_off.cmd
: Sends a power off command to the HS110 wifi plughs110_on.cmd
: Sends a power on command to the HS110 wifi plugmks_poweroff.cmd
: Sends a shutdown command to the KlipperScreenshutdown_sv06.cmd
: Shuts down the KlipperScreen, then powers it off using the HS110 wifi plugtplink_smartplug.py
: Sends commands to the HS110. See above link to download it.These 5 files need to be put into the same directory.
If nothing went wrong, you should now be able to shutdown and power off the printer by executing shutdown_sv06.cmd
.
To power it on, execute hs110_on.cmd
.
tplink_smartplug.py -t 192.168.1.60 -c off
tplink_smartplug.py -t 192.168.1.60 -c on
makerbase
)pi
on a default Raspbian installation@echo off rem === best practice is using a PLINKKEY instead of a cleartext PASSWORD === set PRINTER=mkspi set USERNAME=mks set PLINKCMD=c:\putty\plink.exe set PLINKKEY= set PASSWORD=makerbase rem set PLINKKEY=c:\putty\printer.ppk rem set PASSWORD= rem === nothing should be changed below here === rem MKSPI: allow user "mks" to shutdown/reboot/halt (without "sudo" asking for a password): rem add following to /etc/sudoers.conf (run "visudo"): rem mks ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff set POWERCMD="sudo poweroff" set OPTKEY= if %PLINKKEY%x==x goto SETPW set OPTKEY=-i %PLINKKEY% :SETPW set OPTPW= if %PASSWORD%x==x goto LOGIN set OPTPW=-pw %PASSWORD% set POWERCMD="echo %PASSWORD%|sudo -S poweroff" :LOGIN %PLINKCMD% %OPTPW% %OPTKEY% -batch %USERNAME%@%PRINTER% %POWERCMD%
@echo off set PRINTER=mkspi rem try to ping MKSPI ping -n 1 -w 1000 %PRINTER% >NUL rem bail out, if MKSPI did not respond if errorlevel 1 goto smartplug_off echo Shutting down MKSPI call mks_poweroff.cmd rem doc: PRINT ON SAME LINE: "<NUL set /p =TextToDisplay" <NUL set /p =Waiting for MKS to shutdown :pingloop rem echo "." on same line <NUL set /p =. rem try to ping MKSPI ping -n 1 -w 1000 %PRINTER% >NUL rem bail out, if MKSPI did not respond if errorlevel 1 goto did_shutdown rem otherwise wait a second ping -n 2 127.0.0.1 >NUL rem then try next ping goto pingloop :did_shutdown echo MKS has shut down. echo Waiting additional 7 seconds... ping -n 8 127.0.0.1 >NUL :smartplug_off echo Power off HS110 smartplug... call hs110_off
puttygen.exe
printer.ppk
ssh-ed25519
followed by a lot of gibberish)Putty.exe
, enter mkspi
(or the IP address of your KlipperScreen) into the “Host Name” edit field~/.ssh/authorized_keys
:mkdir -p .ssh
nano .ssh/autorized_keys
printer_pubkey.txt
)CTRL
+X
to exitY
to confirm savingENTER
to confirm the filenamec:\putty\plink.exe -i c:\putty\printer.ppk -batch mks@mkspi sudo poweroff
authorized_keys
file or selected a wrong private key file.sudo visudo
mks ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff
CTRL
+X
to exitY
to confirm savingENTER
to confirm the filenamehs110_on.cmd
and hs110_off.cmd
.py
files.c:\python\pythonw.exe
)hs110_on.cmd
to point to this executable:c:\python\pythonw.exe tplink_smartplug.py -t 192.168.1.60 -c off
hs110_on.cmd
to point to this executable:c:\python\pythonw.exe tplink_smartplug.py -t 192.168.1.60 -c on