Adding "actions" to config.yaml

I'm trying to add some menu controls to turn USB power on/off. I can't figure out what I'm doing wrong in config.yaml.

I'm now trying the example presented in the docs:


  • name: Shutdown
    action: shutdown
    command: sudo shutdown -h now
    confirm: You are about to shutdown the system.

I save the config.yaml file and restart octoprint using sudo systemctl restart octoprint. But, it seems the config.yaml gets overwriten with the original fragment:

actions: []

I also tried restarting from the web interface after changing config.yaml, with same result. config.yaml just gets overwritten.

What am I doing wrong? Is there a better way to do it?

What I want--method to invoke script/run command to turn off USB power after a print completes. Also, controls on the web interface to turn on/off usb.


Gave up on editing config.yaml manually to add actions. I tried defining OCTO codes and using the custom control editor to add buttons to the Control menu.

That works, except you can not push a button on the Controls tab if you are not connected. So, after powering off the USB to the printer, you can't push the control to turn it back on. Of course I can do that outside of octoprint using an ssh session.

Finally got an "Enable USB" system command using the System Commands Editor plugin.

It seems a little buggy--duplicates of the command kept showing up, so I ended up with five or six copies of each command I added. But, after I deleted all the extra copies, it works ok.

So, I can disable USB from the control pan, but only enable it from the Systems menu (or from the Marlin firmware with an M118). What I need, I think.

System command editor plugin I think is the one that has an issue where it can also wipe out all the commands. So once you got it configured, disable the plugin to avoid any more issues.

1 Like