The code just sends M80 or M81 to printer. It is up to printer and it's firmware to turn power on/off. Most do NOT support this feature. It requires a ATX power source that delivers always 5V standby and only switches 12V depending on a pin signal.
For Raspberry you need to create a custom command that you then call from server interface. See user manual->advanced setup on how to do that.
The code just sends M80 or M81 to printer. It is up to printer and it's firmware to turn power on/off. Most do NOT support this feature. It requires a ATX power source that delivers always 5V standby and only switches 12V depending on a pin signal.
For Raspberry you need to create a custom command that you then call from server interface. See user manual->advanced setup on how to do that.
Oh. Ok. I do it but now it placed in general menu. Can i add it to menu of the printer.
Commands are normally visible in the global menu. If you want one to appear only in
in the printer menu, add the attribute "slugname" to command. You see the slugname
when you select a printer as part of the path.
with that it knows it is printer related and moves it to printer context menu.
In /var/lib/Repetier-Server/database/extcommands.xml: <command> <name>printerOn</name> <execute>bash /home/pi/scripts/printerOn.sh</execute> <confirm>Really turn on the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> <slugname>Sprinter</slugname </command> <command> <name>printerOff</name> <execute>bash /home/pi/scripts/printerOff.sh</execute> <confirm>Really turn off the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> <slugname>Sprinter</slugname> </command> <execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute> <execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute>
You added it as tag, try as attribute <command slug="Sprinter">
looking into code I saw that slugname must be slug as attribute name.
Now it looks like:
<command> <name>printerOn</name> <execute>bash /home/pi/scripts/printerOn.sh</execute> <confirm>Really turn on the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> <command slug="Sprinter"> </command> <command> <name>printerOff</name> <execute>bash /home/pi/scripts/printerOff.sh</execute> <confirm>Really turn off the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> <command slug="Sprinter"> </command> <execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute> <execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute> </config>
<command slug="Sprinter"> <name>printerOn</name> <execute>bash /home/pi/scripts/printerOn.sh</execute> <confirm>Really turn on the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> </command> <command slug="Sprinter"> <name>printerOff</name> <execute>bash /home/pi/scripts/printerOff.sh</execute> <confirm>Really turn off the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> </command> <execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute> <execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute> </config>
<command slug="Sprinter"> <name>printerOn</name> <execute>bash /home/pi/scripts/printerOn.sh</execute> <confirm>Really turn on the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> </command> <command slug="Sprinter"> <name>printerOff</name> <execute>bash /home/pi/scripts/printerOff.sh</execute> <confirm>Really turn off the printer?</confirm> <!-- Define if command should show up in local printer interface, default true.--> <local>true</local> <!-- Define if command should show up in remote printer interface, default true.--> <remote>true</remote> </command> <execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute> <execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute> </config>
Comments
For Raspberry you need to create a custom command that you then call from server interface. See user manual->advanced setup on how to do that.
with that it knows it is printer related and moves it to printer context menu.
<command>
<name>printerOn</name>
<execute>bash /home/pi/scripts/printerOn.sh</execute>
<confirm>Really turn on the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
<slugname>Sprinter</slugname
</command>
<command>
<name>printerOff</name>
<execute>bash /home/pi/scripts/printerOff.sh</execute>
<confirm>Really turn off the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
<slugname>Sprinter</slugname>
</command>
<execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute>
<execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute>
<command slug="Sprinter">
looking into code I saw that slugname must be slug as attribute name.
<name>printerOn</name>
<execute>bash /home/pi/scripts/printerOn.sh</execute>
<confirm>Really turn on the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
<command slug="Sprinter">
</command>
<command>
<name>printerOff</name>
<execute>bash /home/pi/scripts/printerOff.sh</execute>
<confirm>Really turn off the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
<command slug="Sprinter">
</command>
<execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute>
<execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute>
</config>
<command slug="Sprinter">
<name>printerOn</name>
<execute>bash /home/pi/scripts/printerOn.sh</execute>
<confirm>Really turn on the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
</command>
<command slug="Sprinter">
<name>printerOff</name>
<execute>bash /home/pi/scripts/printerOff.sh</execute>
<confirm>Really turn off the printer?</confirm>
<!-- Define if command should show up in local printer interface, default true.-->
<local>true</local>
<!-- Define if command should show up in remote printer interface, default true.-->
<remote>true</remote>
</command>
<execute name="play" allowParams="true">sh /home/pi/scripts/printerOn.sh</execute>
<execute name="off" allowParams="true">sh /home/pi/scripts/printerOff.sh</execute>
</config>