MQTT or HTTP Message when Shutdown server


I would like to shutdown my 3D Printer and my Repetier Server after the Repetier Server Shutdowns with a delay.
So i need to get the information that the Server shuts down, either by manually shutdown or automatically after finisihing printing.
I thought i can get that information via the MQTT Function, but i can't find any value which tells me the server shuts down now.
Only thing is the connected state, but i don't want to use this, because if there is a problem with the wifi or whatever it also tells me it is not connected and then i definitely want not to shutdown the system.

So is there any way to get the information?
It could be via MQTT, but it would be also possible for me to make this via an http call from the repetier server side or an UDP Command or whatever...

thanks ans best regards



  • The server has no own shutdown command, so ha sno control over it.

    I guess you are using the pi image and see the "Shutdown" button. This comes from the file /var/lib/Repetier-Server/database/excommands.xml - that is a extra file to teach server new commands. So these commands are just names and linux commands to server. So what you can do as solution is modify that file to call your special shutdown script instead of shutdown -h now directly. Make sure it works as user repetierserver or if you put sudo in front that it is listed in sudoer list.

    Here in your script you can use curl to make a url call or call a server function that sends a mqtt message. See server commands for this. Add a good wait so you are sure the message gets delivered and continue with shutdown so you are down when power gets disabled.
  • But how can I manage it to get that info if it shuts down automatically after print?
  • But how can I manage it to get that info if it shuts down automatically after print?
  • You send that info before running the shutdown, so you push the data to who ever is responsible to disable later the power. Once send you wait a bit to be sure that message is received and then do the real shutdown. As I said the shutdown after print does just execute your shutdown g-code so it does only what you want in the order you want.
  • I got it partially to work, i made a python script which does what  i want it to do. Then i changed the xml file.
    When i tell it via the web-frontend to shutdown i get the udp message and it shuts down.
    But my problem is that in the User Interface on my attached HDMI Panel, the Shutdown Button is disappered. If i revert the changes in the xml file to the normal content, the button is there again.
    So what can I do with that?
  • First the commands do normally not appear on start page. All configured external command buttons appear in the "Server Cmds." page, so there you should see your button if you did not add a xml error somehow. In that case use a xml validator.

    Now for the front screen. There the command appears if it contain "shutdown -h" so the solution is to add these 2 parameter to your script call even if you ignore it. Just to make it appear on front screen if you understand.
  • Now it works, thank you very much.
Sign In or Register to comment.