Shutdown server with home assistant
Apologies if this is simple but I'm not very good at coding or understanding APIs! I'm looking to set a curl command in home assistant so I can shut down my repetier server from there. I've got the default command in extcommands.xml so can do it via the web interface and I've read the API documentation. Can someone help me with the correct API URL to send from home assistant to invoke the 'shutdown' command? Thanks in advance
Comments
action: "runExternalCommand", data: {id: 0}, printer: "slugname"
id depends on position in extcommands in case it is a menu command and not an execute command. execute command would be run as @execute but requires printer to be online.
http://192.168.1.100:3344/printer/api/?a=runExternalCommand&data={"id":0%7D&apikey=xxxx.xxxx.xxxx.xxxx
Edit: not posting with correct formatting, I'll just give it a go and cross everything! Thanks for your help!
only encode the data content e.g. with this one: http://www.utilities-online.info/urlencode/#.YCI20mT0kyo
curl "http://192.168.1.100:3344/printer/api/?a=runExternalCommand&data={"id":0}&apikey=xxxxxxxxxxxxx"