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
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.
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.