Multiple commands from system menu item in config.yaml


#1

I'm running OctoPi 1.3.6 (Stable) on an original Pi B+

I am trying to get a menu item in config.yaml to execute multiple commands, but I am doing something wrong. I am using this code

system:
  actions:
  - action: GPIOer
    type: commands
    commands:
    - gpio -g write 17 1
    - gpio -g write 18 1
    name: GPIOer
  - action: GPIOer2
    type: commands
    commands:
    - gpio -g write 17 0
    - gpio -g write 18 0
    name: GPIOer2

But it generates the error:
Command custom:GPIOer2 does not define a command to execute, can't proceed

I've also tried:

system:
  actions:
  - action: GPIOer
    command: gpio -g write 17 1
    command: gpio -g write 18 1
    name: GPIOer
  - action: GPIOer2
    command: gpio -g write 17 0
    command: gpio -g write 18 0
    name: GPIOer2

But that ignores the second command in each case.

The relevant section around line 77 of /etc/init.d/octoprint looks like this:

       --exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK -- serve $DAEMON_ARGS
       gpio export 17 out
       gpio export 18 out
       RETVAL="$?"

I know that it's something simple, but I just can't seem to work out what. Please can someone point me in the right direction, thanks.


#2

There's no indication that more than one command is possible in that section. Just join them on the same line with a semicolon.


#3

Brilliant. Thank you so much. This completely solved my problem.

system:
  actions:
  - action: GPIOer
    command: gpio -g write 17 1; gpio -g write 18 1
    name: GPIOer
  - action: GPIOer2
    command: gpio -g write 17 0; gpio -g write 18 0
    name: GPIOer2