Disconnect and reconnect the serial connection via the console

Hello, is it possible to disconnect and reconnect the serial connection via the console (terminal)? So the same process as the Disconnect and Connect buttons in the web interface.
Version 0.18.0, running on Raspberry Pi 3 Model B Plus Rev 1.3
Thanks

Hello,
yes, you can do this with curl and the API
Specifically Connection handling

# connect octoPrint and the printer 
curl -s -X POST  -H "Content-Type: application/json" -H "X-Api-Key":"$OCTOPRINT_X_API_KEY" -d '{"command":"connect"}' http://$PRINT_HOST/api/connection
sleep .5

Replace $OCTOPRINT_X_API_KEY with an API key you generate in Settings and $PRINT_HOST with the hostname or IP to reach your box.

1 Like

It works!! Thank you so much :+1: :+1: :+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.