Closed garyt72 closed 2 years ago
I'd like to see this implemented as a switch for connect/disconnect I think, but sure I think it make sense.
I think you could add an api request to your configuration.yaml as a shell command, something like:
# Exposes service shell_command.printer_connect
shell_command:
printer_connect: curl -v http://<printerIP>/api/connection -d '{"command":"connect"}' -H 'Content-Type: application/json' -H 'X-Api-Key: !secret octoprint_api'
Or, with the API directly in the file and not using the secret file:
# Exposes service shell_command.printer_connect
shell_command:
printer_connect: curl -v http://<printerIP>/api/connection -d '{"command":"connect"}' -H 'Content-Type: application/json' -H 'X-Api-Key: <YOUR-API-KEY>'
And then just pull the shell command into a button on your Lovelace dashboard somewhere...
Cheers!
Issue was resolved on #62
Thanks so very much for this - I've really enjoyed using it and it has made OctoPrint even better with the fast responsive integration with HomeAssistant.
Is it possible to implement the capability to send more commands to OctoPrint - this specific request is to simulate the "Connect" button. My use case is that I want to leave OctoPrint running all of the time, but turn off the printer off when not in use. The issue is that OctoPrint goes to an error state and stops trying to reconnect after a while.
The idea is that I turn on the printer, wait 10-15 seconds, then tell OctoPrint to connect.