Custom commands do not work

Hi,
my plan is to have buttons that switch a 433Mhz socket on and off.
So at first I found the plugin "Action Commands" and thought this would work for my needs. I created two Actions of Type system:
action:printerOn rpi-rf_send -t 5 -r 10 -p 500 2439221
action:printerOff rpi-rf_send -t 5 -r 10 -p 500 2858693

I have tested both commands by executing them in the linux command promt and they work.

In OctoPrint I tried executing them in the Terminal by sending:
M876//action:printerOn
M876//action:printerOff

I receive the message "ok" but nothing happens. I also tried to change the action types to gcode, but nothing changed.

What am I doing wrong?

I also tried another plugin called GCODE System Commands. Here I created
OCTO100 rpi-rf_send -t 5 -r 10 -p 500 2439221
OCTO101 rpi-rf_send -t 5 -r 10 -p 500 2858693

When sending OCTO100 or OCTO101 in the Terminal I receive:
Return(GCodeSystemCommands): error

I have no idea why my commands work when executing them directly on the octopi linux distribution but not when I try sending them over the web interface.

Any chance anyone can help me?

Actually my final plan would be to sent the printerOn command after starting a print job so the socket for the printer turns on and after the print is done the printerOff command should be sent after a delay of a few seconds so that the printer turns off.

I have an Ender 3 with Creality 3D 1.1.6 and OctoPrint 1.3.11 on OctoPi 0.17.0

Cheers atix

In that case you should rather take a look at something like the PSU Control Plugin that already does what you are trying to do instead of going through trigger GCODE which makes everything overly complicated and awkward.

When you are on the command line you are in a so called shell. Said shell defines some stuff like a PATH on which to look for commands. When executing things from within OctoPrint you (usually) don't have a shell so you need to provide the full path to the command in question. To figure that out, enter which rpi-rf_send on the command line, it will print out the resolved full path to rpi-rf_send.

Which one would that be precisely? This one? If so you probably configured it right (apart from the aforementioned lack of the full path), however your way of trying to trigger it makes no sense. First of all, the action commands are something that's sent by the firmware to OctoPrint, not the other way around (which is why I also believe that this is the wrong tool to choose here, it's kinda backwards). And secondly, M876 is a command that has nothing to do with action commands but is rather a command used in firmware that has prompt support to communicate the selected prompt option. You probably wanted to use M118 which on recent mainline Marlin will echo back to the host whatever you are providing as a parameter.

However, as already pointed out, sending something to the firmware to receive something back to then trigger something locally is very much about the most complicated route you can take for this and the cleanest solution would really be to just use PSU Control.

1 Like

Hello..

M876//action:printerOn
M876//action:printerOff

I do the same but i use M118

For marlin it should be:

M118 A1 action:printerOff

http://marlinfw.org/docs/gcode/M118.html

2 Likes

Thank you for the informative reply!
The hint regarding the shell and the necessary full path helped!
I got it running for both mentioned plugins now :blush:.
Also thank you for mentioning the PSU Control Plugin, that seems to be what I am looking for. I think I am going to use the GCODE System Commands I have created as PSU On and Off commands.
Awesome, I was looking for a solution for quite a while now...Thanks again!

Edit: Ok just found out that I can just use system commands there. So no further plugin necessary, perfect.

Thank you for the hint! I got it working now :blush:!
My action commands look like this
M118 //action:printerOff
M118 //action:printerOn

So it seems as if I was using the wrong command...
Thank you!

1 Like

Is there a M118 command that works with the Stock CR-10 Firmware? Or is the "Actions Command" plug-in not compatible?

Send: M118 //action:done
Recv: ok
Recv: echo:Unknown command: "done"

done is configured as a system command in "Action Commands" plug-in.